-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi everyone, correct me if my perception is wrong.
I am currently trace into the system to identify how the spring + zk + hibernate causing lazy initialization exception although we include OpenSessionInView listener and TransactionSynchronizationManagement in zk.xml and web.xml. The problem i found is causes by the number of query called. For instance, I have 22 records in the list item, however, it will only called up to 20 records, where the 2 records will be called later. When we set the lazy=true, this is how the lazy initialization exception being thrown.
The way to solve this is by setting the lazy=false, however, this is not a good practice. I have try with a lot of way, but is not helpful. First of all, I try to use EntityManager to merge the bean, however, because of my existing architecture is using spring to manage the session factory by HibernateDaoSupport, therefore, the entity name is required every time i make a called to the db. Because of this, i use SpringUtil to inject the session factory from the application context, and, this time it work but is not help in the current problem (base on my explanation in above sentence).
Is there anyone has a better solutions towards this issue? Your help and concerned is highly appreciated and thanks for taking time to read up this content
Asked: 2009-03-27 04:11:57 +0800
Seen: 361 times
Last updated: Apr 02 '09