-->
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: IInterceptor: The Session may not be invoked from a callback
PostPosted: Fri Jun 08, 2007 6:27 pm 
Expert
Expert

Joined: Fri Oct 28, 2005 5:38 pm
Posts: 390
Location: Cedarburg, WI
Hibernate version: 1.2.0.GA

I noticed in the API documentation for IInterceptor, it says
Quote:
The Session may not be invoked from a callback
(nor may a callback cause a collection or proxy to be lazily initialized).


Is this really the case for all of the IInterceptor methods? In particular, I don't see why the restriction should be true for PreFlush() and PostFlush(), since those methods take the collection of all entities in the session cache as an argument. If you can't touch the passed entities (any type of access, after all, could cause lazy loading) then why are they passed at all?

In any case, in PreFlush() we call out to business logic that does all kinds of access and modification to the entities being flushed (we have our own determination for which are dirty), and so far we haven't encountered any problems. It's much cleaner to perform pre-flush logic on dirty entities through PreFlush() since you have the real entities and apparently can do whatever data access you want, rather than in the abysmal FlushDirty(), where you get horrid parallel arrays of property names and values, and you can't do any data access with the session ...

Can someone clarify this?


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.