Using preInsert, preUpdate, prePersist, etc. to selectively prevent inserts and updates [message #1110297] |
Mon, 16 September 2013 17:28 |
Randy Tidd Messages: 8 Registered: August 2013 |
Junior Member |
|
|
Our data model has a Statement which has many LineItems. There are numerous other entities related to both of these.
Some LineItems are derived, and we would like to have these present in memory, but don't want them stored in the database.
The merge and persist operations cascade, so any merge or persist call anywhere in the data model can trigger an insert of a LineItem if EclipseLink determines that they need to be saved. I am looking for a hook in EclipseLink where I can prevent the insert of certain LineItems.
I registered an event manager/listener and am responding to methods such as preInsert, preUpdate, prePersist, etc. These methods receive a DescriptorEvent and I am trying to figure out if I can modify the event to prevent selected inserts. I have looked for documentation describing these methods in detail, the sequence in which they are called and how to modify the event, but have not found anything, any pointers would be appreciated.
I am looking through the API in DescriptorEvent but am not seeing where I can alter the operation to eliminate certain objects, nor really am I sure if this is a supported approach for preventing selected inserts, and if there is a better way.
Any tips or examples would be greatly appreciated.
Randy
|
|
|
Powered by
FUDForum. Page generated in 0.02952 seconds