I see, TreadLocal stuff becomes popular and I think it can be implemented in SessionFactory.currentSession(); Session can be mapped to Thread in "standalone" mode and to JTA Transaction in "managed" mode (Transaction is mapped to Thread in JTA too). Factory implementation opens it once per transaction and Transaction Synchronization can close session/connection in "afterCompletion" and throw "IllegalStateException" if "managed" session accessed outside transaction. It is trivial solution, but can help to eliminate workarounds and error prone code.
------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel