Static Weaving and Lifecycle Methods [message #1827306] |
Tue, 12 May 2020 17:47  |
Roland Welker Messages: 13 Registered: October 2013 |
Junior Member |
|
|
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 #1827494 is a reply to message #1827306] |
Fri, 15 May 2020 18:25   |
Chris Delahunt Messages: 1389 Registered: July 2009 |
Senior Member |
|
|
Can you provide more detail on what you are doing and when? Changing an entity within an entity listener event entirely depends on what you are doing and the event to determine how/when and even if it gets picked up in the current transactional context. Not all events were intended to allow you to change values, and it would be expensive to recalculate changes after every event type that could be fired.
Chances are good though that if it is working with weaving turned off, you are accessing the property directly instead of through its accessor methods. Change tracking injects code to watch for changes that you might be bypassing.
[Updated on: Fri, 15 May 2020 18:28] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02618 seconds