Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forums@PreUpdate not called with AspectJ
https://www.eclipse.org/forums/index.php/mv/msg/170000/540058/#msg_540058
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]]>John Howard2010-06-14T17:34:45-00:00Re: @PreUpdate not called with AspectJ
https://www.eclipse.org/forums/index.php/mv/msg/170000/540065/#msg_540065
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]]>Tom Eugelink2010-06-14T18:20:16-00:00Re: @PreUpdate not called with AspectJ
https://www.eclipse.org/forums/index.php/mv/msg/170000/540878/#msg_540878
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 Sutherland2010-06-17T14:24:42-00:00