struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wild_oscar <mig...@almeida.at>
Subject Re: [S2] Where to put hibernate's SessionFactory?
Date Wed, 05 Sep 2007 23:04:31 GMT

Thank you. I've implemented the non IoC version of it, which I found to be
almost the same as in
http://struts.apache.org/2.0.9/docs/non-ioc-version-of-opensessioninviewinterceptor.html
http://struts.apache.org/2.0.9/docs/non-ioc-version-of-opensessioninviewinterceptor.html 

Antonio Petrelli-3 wrote:
> 
> 2007/8/31, wild_oscar <miguel@almeida.at>:
>>
>> I am making my first web app and I found out today I was doing something
>> wrong:
>>
>> I was building a SessionFactory on my HibernateEntityManager:
>>
>> _sessionFactory = configuration.buildSessionFactory();
>>
>> This EntityManager is called on the action so, basically, I was creating
>> a
>> SessionFactory on each request.
>>
>> Searching the web, I panicked! Most people talk about using Spring in
>> addition to Struts2 + Hibernate.
>>
>> Having just started on Struts2, and not having even completed my first
>> web
>> app, I feel I will lose another week just to understand the basics of
>> Spring
>> to understand what is needed.
>>
>> My question is: what is the most appropriate way of binding the
>> SessionFactory to the web application? Can someone pinpoint the basics
>> and/or a tutorial where I can learn this? And how/when is the
>> sessionfactory
>> closed in the web application?
> 
> The "Open session in view" pattern can help you:
> http://www.hibernate.org/43.html
> If you are using Spring, there is a ready-made filter:
> http://www.springframework.org/docs/api/org/springframework/orm/hibernate/support/OpenSessionInViewFilter.html
> 
> Antonio
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-S2--Where-to-put-hibernate%27s-SessionFactory--tf4361648.html#a12512623
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message