View Full Version : How-to: Spring.NHibernate + Spring.Web
Nicoláz
02-06-2007, 04:17 AM
Hi, is there any example (or doc) that show the recomended way to use Spring.NHibernate integration in a Spring.web application?
Thanks in advanced.
Nicolaz
Erich Eichinger
02-06-2007, 10:14 PM
Hi,
Unfortunately there's no "all inclusive" sample available yet. But there isn't much difference. If you want to reuse one single session during a request, you should additionally specify OpenSessionInViewModule in your web.config:
<system.web>
...
<httpModules>
<add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
<add name="OpenSessionInView" type="Spring.Data.NHibernate.Support.OpenSessionInViewMo dule, Spring.Data.NHibernate"/>
...
</httpModules>
</system.web>
That's it.
cheers,
Erich
Nicoláz
02-07-2007, 12:22 PM
Ok, Thanks,
I have another question: I create my DAO objects using HibernateDaoSupport. How should I configure the scope of this objects? Is correct to use scope=request?
Thanks,
Erich Eichinger
02-07-2007, 12:30 PM
Hi,
as long as your DAOs don't maintain any state (which I would strongly recommend!) you should configure them as singletons (which is the default anyway for good reasons)
cheers,
Erich
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.