Lately I decided to implement in my project CMT transactions (jBoss5, Hibernate, jta postgres datasource). Everything is working fine except Hibernate.initialize() in my entities. It works in EJB beans but when trying to invoke initialize in entity getter I get "couldn't associate with session" exception. It worked just fine before implementing transactions. Anyone got accros same problem ?
Asked
Active
Viewed 1,111 times
2 Answers
0
From the following reference page you may need to ensure the current properties are configured correctly for CMT
- set
hibernate.transaction.manager_lookup_class
to a lookup strategy for your Java EE container (see here for a list of JTA transaction managers) - set
hibernate.transaction.factory_class
toorg.hibernate.transaction.CMTTransactionFactory

Arjan Tijms
- 37,782
- 12
- 108
- 140

toolkit
- 49,809
- 17
- 109
- 135
-
I wrote that everything works except Hibernate.initialize() and that only in entities. I have already set hibernate.transaction.manager_lookup_class. (I don't want to set transaction factory because Hibernate entity manager doesn't like that). Anyone idea what is the problem ? – Dogrizz Mar 13 '09 at 17:14
0
Ok after days browsing the internet I found what is the problem. When u flag method as Supports transactions. It doesn't start them. If you retrieve objects out of transaction they are out of session and therefore u cannot initialize their properties...

Dogrizz
- 161
- 1
- 1
- 8