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.  [ 4 posts ] 
Author Message
 Post subject: PostFlush Not working as expected
PostPosted: Tue Nov 08, 2005 2:38 am 
Senior
Senior

Joined: Sat Sep 10, 2005 3:46 pm
Posts: 178
I am tapping into the PostFlush method of IInterceptor. I am assuming to have only the objects that have been updated or saved to the database in the entities collection passed to PostFlush. The documentation is very vague with regards to this paramater, all it says is "the entities". Hibernate in action shows an example of an Auditing interceptor that performs auditing in the PostFlush event, so I am thinking that my assumption is correct - the entities collection is a collection of objects that were saved or updated to the database.

Stepping through the PostFlush event with the debugger has shown this to not be the case. The entities collection appears to hold all of the objects that have been loaded into the session. I have checked the sql for the updates of a specific transaction and I am only seeing one table getting written to but the entitites collection holds about 7 objects.

Whats the correct behavior?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 08, 2005 5:42 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Yes, all objects are passed to postFlush both in H2.1.8 and H3.1. You can probably try remembering dirty objects in OnFlushDirty and clear the list in PostFlush after processing it. Be careful with concurrency issues though, if you use a single interceptor per session factory.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 08, 2005 9:57 am 
Senior
Senior

Joined: Sat Sep 10, 2005 3:46 pm
Posts: 178
Thanks Sergey. I see what I can do now. Yes, I am using a single interceptor per session factory. What kind of concurrency issues are we talking about here? Does the session factory use the interceptor as a singleton?

If I store the updates in a hashtable, could I potentially have multiple writers to the hashtable? If I use the Synchronized hashTale wrapper will that be sufficient?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 08, 2005 12:10 pm 
Senior
Senior

Joined: Sat Sep 10, 2005 3:46 pm
Posts: 178
Ok, from the documentation I see that the Interceptor is a single instance for a session factory. In the documentation it also mentions that SessionFactory scoped interceptors should implement ReadResolve(). As far as I can tell there is no such operation in .Net. Isn't that a Java deserialization operation?

Can you use a SessionFactory scoped interceptor and a session scoped interceptor? Or will the session scoped interceptor override the factory scoped one?


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

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.