Skip to main content


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 17:34 Go to next message
John Howard is currently offline John HowardFriend
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 18:20 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 817
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 14:24 Go to previous message
James Sutherland is currently offline James SutherlandFriend
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 Mar 29 13:44:43 GMT 2024

Powered by FUDForum. Page generated in 0.03713 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top