Hibernate version: 3.1.3
We are using Websphere Application Developer (and Websphere Process Server) and EJB 2.1 (stateless session) and we have a problem with the Hibernate session.
We have separate layer for data access (there are some Hibernate persistent objects -DataBase Objects- and some stateless session beans for get data from database (uses HQL and session.load()). For this layer (and for Hibernate) we use CMT connection factory and CMT transaction manager. Session bean methods returns lazy DataBase Objects (not initialized).
In the application workflow (business processes) we can only use DataObjects so we have to map every DataBase Object to DataObject. This happens in another layer, so session should be still opened in this layer to initialize DataBase Objects.
The problem is that if we want to access a lazy relationship in this layer, we get de LazyInitializationException because the session is closed. I think the CMT transaction manager closes the session automatically when the method finishes and when accesing the session in the mapping layer to acces a lazy relationship, it has been previously closed.
Is there any idea how to force the session to remain open after returning from stateless session bean method using global transaction?
|