This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OpenSessionInViewFilter problem

 
Luciano A. Pozzo
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have been using the OpenSessionInViewFilter has some time in projets. But in this project I catch this problem:

(I am using Hibernate, Spring MVC, Acegi and Sitemesh)




Has you can see, the OpenSessionInViewFilter is called in stack!


and my web.xml:




Thank-you
[ September 11, 2007: Message edited by: Luciano A. Pozzo ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure that the problem comes from the filter. Do you have a "cadastro.jsp" ? There seems to be a problem in a JSTL forEach loop in that file.
 
Luciano A. Pozzo
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Christophe,

Thank-you for the reply. So, I made some tests for detect where is the problem. And I believe that it is something wrong in my transaction control, in the business layer. For some reason it is closing the hibernate session.

How I had this conclusion, because I tried to access from the controller directly to DAO, and worked fine (did not closed the hibernate session and the lazy worked). And when I use through the business layer, I catch the org.hibernate.LazyInitializationException.

So, the question is, when the transaction control commit a transaction, I should lost the hibernate session?


Thank-you
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I don't about this kind of problem. I've found a document on Hibernate which tells that sessions obtain with getCurrentSession will be flushed and closed when the transaction is committed. Please have a look at this page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic