Hi all,
I have been experimenting with the Interceptor interface trying to get some work done on my persistence entities after an update/save. I am mainly using postFlush to get the state of my entities and record that state somewhere else in my application (a requirement). Now, when I try to get the state of my entity in postFlush, I get a LazyInitialization exception (thought I had done enough work with Hibernate not to see this issue come up again :)). So, seems like in postFlush, the session is gone and I cannot do much with any attributes in my entity that were not initialized.
How can I get around this issue? What I want is for a mechanism to get all my entity's state after it has been persisted to the database (postFlush) and not have to deal with Lazy initialization issues. This needs to work for both creates and updates. Any ideas on how to enable this would be greatly appreciated. If you want me to post my mapping files/code that would be no problem but I am looking for some pointers from those who have use Interceptor and are familiar with when a session is still available to do work on the entity and when it is not. Can I do a copy of what is there in preFlush? The APi does not have enough documentation, although it could be very useful in verious situations!!! Might do this myself after I am over this hump!!!
thanks...
|