Static Weaving and Lifecycle Methods [message #1827306] |
Tue, 12 May 2020 13:47  |
Eclipse User |
|
|
|
Hi Everybody,
I am using eclipselink (2.7.5) in a aws lambda project with a java 8 runtime. I have a utility class holding 2 life cycle methods (PrePersit and PreUpdate, annotated approprietly) which are than assigned via the entity listener annotation to a mapped superclass, updating create/modify dates and a soft delete flag.
This works all fine.
To improve performance I started using static weaving build with maven (de.empulse.eclipselink), Lazy Loading and Jackson JSON field filter to avoid a full entity tree being fetched and sent.
Once the static weaved lambda has been deployed, the EntityListener is still being invoked and sets the field values (I can see it in the objects after the persist/commit, however the values are not persisted to the database.
For testing purposed I have taken the weaving task back out and the values are showing up correctly in the db.
I have found a few related posts and one Eclipselink bug report going back to 1.x version, but no actual solution. I have also tried:
<property name="eclipselink.weaving.changetracking" value="false"/>
To see if this would make a difference without effect.
All entities, mapped super classes and Entity Listener are explicitly listed in the persistence.xml file.
Has anyone any solutions to use static weaving and Entity Listener successfully?
Thank you very much,
Roland
|
|
|
|
|
Re: Static Weaving and Lifecycle Methods [message #1827677 is a reply to message #1827495] |
Wed, 20 May 2020 10:32  |
Eclipse User |
|
|
|
The changes not detected - do you mean the listener is not invoked, changes made by the listener are not detected, or changes to mapped superclass properties are not detected and updated in the database at all? This is only showing a custom merge method signature that hints at reflection being used, something I mentioned you might be doing in your listener and would certainly cause issues to any woven methods if you are bypassing the public accessors. JPA requires you use method access when using any sort of lazy fetching, and all EclipseLink weaving is built of that premise.
You might want to create a simple test case, as we know (it is in EclipseLink build tests) that weaving a mapped superclass hierarchy 'works'. We need to see the differences from the standard use cases and what you are doing to figure out what might be going wrong.
|
|
|
Powered by
FUDForum. Page generated in 0.04219 seconds