What's the best way to use Hibernate with a thread that commits a JTA transaction and immediately begins another? The best way I've found is to call (in pseudocode):
Code:
hibernate.Session.disconnect();
UserTransaction.commit();
hibernate.Session.reconnect();
... which works. But it seems wasteful to release the JDBC connection and then immediately allocate another one. Is there a more efficient way?
Just to add difficulty, I need to use global (JCS) caching; which means I can't pass a JDBC connection to hibernate.SessionFactory.openSession. (Or so I understand from
http://forum.hibernate.org/old//893667.html.)