Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » @PreUpdate not called with AspectJ
@PreUpdate not called with AspectJ [message #540058] Mon, 14 June 2010 13:34 Go to next message
John Howard is currently offline John Howard
Messages: 83
Registered: July 2009
Member
I am working on a project that is looking to replace Hibernate with EclipseLink, but we are running into a problem with AOP. The project is using the AspectJ compiler, and what we are finding is, for these compiled classes, EclipseLink does not call a @PreUpdate annotated method.

I have created a simple project that works OK if the standard compiler is used but fails if the AspectJ compiler is used and if I use the AspectJ compiler and then simply replace the problem class file with a class file compiled using the standard compiler then @PreUpdate annotated method is called. We have also not had any problems with Hibernate and AspectJ.

We are using EclipseLink 2.0.2 and AspectJ 1.6.8 with a Java 1.6 target

Not really sure what to do next so any thoughts on how we might resolve this would be most welcome?

Thanks,

John
Re: @PreUpdate not called with AspectJ [message #540065 is a reply to message #540058] Mon, 14 June 2010 14:20 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom Eugelink
Messages: 806
Registered: July 2009
Senior Member
You could refrain from using annotations and use Eclipselink embedded (Toplink's) events (these are handled via interfaces).
You could try static weaving Eclipselink before applying AspectJ.


On 2010-06-14 19:34, John Howard wrote:
> I am working on a project that is looking to replace Hibernate with
> EclipseLink, but we are running into a problem with AOP. The project is
> using the AspectJ compiler, and what we are finding is, for these
> compiled classes, EclipseLink does not call a @PreUpdate annotated method.
> I have created a simple project that works OK if the standard compiler
> is used but fails if the AspectJ compiler is used and if I use the
> AspectJ compiler and then simply replace the problem class file with a
> class file compiled using the standard compiler then @PreUpdate
> annotated method is called. We have also not had any problems with
> Hibernate and AspectJ.
>
> We are using EclipseLink 2.0.2 and AspectJ 1.6.8 with a Java 1.6 target
>
> Not really sure what to do next so any thoughts on how we might resolve
> this would be most welcome?
>
> Thanks,
>
> John
Re: @PreUpdate not called with AspectJ [message #540878 is a reply to message #540058] Thu, 17 June 2010 10:24 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Are you adding the @PreUpdate annotation using AspectJ, or is it in the original class file? What about the other annotations in the class, are they found?

It could be that AspectJ is stripping the annotations from the class file, can you access the annotation using reflection?

It might have something to do with weaving in EclipseLink, what happens if your turn weaving off?

As a workaround you could define an event listener in your orm.xml, or register one using a DescriptorCustomizer.


James : Wiki : Book : Blog : Twitter
Previous Topic:Assigning a numeric sequence value to a varchar column
Next Topic:NullPointerException using mapped-superclass
Goto Forum:
  


Current Time: Fri Jul 25 14:17:43 EDT 2014

Powered by FUDForum. Page generated in 0.02197 seconds