-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Appropriate event listener to capture *all* merge/persists
PostPosted: Wed Apr 16, 2008 12:49 pm 
Newbie

Joined: Tue Dec 05, 2006 2:47 am
Posts: 9
Hibernate 3.3.0 Snapshot

I have a fairly involved association graph for my entities and I need to hook in to the appropriate event handler to post-process all entities as they are saved.

All my relationships are bi-directional, with the "one" side owning the relationship

For example:

Document
has many LineItems
has many SupplierProducts
has Supplier
has Manufacturer
has many Shipments
has Customer
has Contacts


Which event listener allows me to capture the original Entity (for each of the associations as they are cascaded) with ID assigned and then call my callbacks that I add to those entities?

I have hooked into MergeEntityEventListener, and I get access to the original entity (so I have access to the callbacks assigned to that object), and the newly created identifier for the object, but the problem is the event doesn't get called for *every* entity in the graph. As per the example above, the SupplierProducts and Shipments are not captured in the "merge" event. Maybe it's because they are collections. Which events do I need to hook into to capture the saving of *all* entities in the entire graph, including the collection entities, and such an event where I have access to the original objects (with my callbacks assigned) and the newly created identifier for each entity as been assigned?

Aaron


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.