Hi...I'm using Hibernate 2.1.6 and using a ThreadLocal variable to hold my Session object. I need to initialize an Oracle context (by calling a stored procedure) for all my connections prior to sending any inserts/updates through it.
I first tried creating my own connection, calling the pl/sql procedure from it, and then passing it to openSession -- however, if I do it this way I loose the ability to use second-layer caching.
Therefore, what I decided to do was call openSession(), get the connection using session.connection() and then run the pl/sql from that. For some odd reason, the connection gets closed automatically after a save/update or retrieve. And, the next call to get the Session from the ThreadLocal variable does not re-execute my procedure.
Any assistance would be much appreciated. Thanks!
|