our project only query data over a legacy database, can we use a stateless session by default when spring framework auto injected session by OSIV situation?
I mean the base class NHibernateRepository's method GetCurrentSession can retrieve a stateless session object.
Does it work that I change _sessionFactory.GetCurrentSession() to _sessionFactory.OpenStatelessSession() ?
public abstract class NHibernateRepository
{
private ISessionFactory _sessionFactory;
public ISessionFactory SessionFactory
{
protected get { return _sessionFactory; }
set { _sessionFactory = value; }
}
protected ISession CurrentSession
{
get { return _sessionFactory.GetCurrentSession(); }
}
......
But my Spring configurations will left as the regular setting:
<!-- Session Factory Configuration -->
<object id="SessionFactory" type="MyProject.Infrastructure.NHibernate.NHibernateLocalSessionFactoryObject, MyProject.Infrastructure">
<property name="DbProvider" ref="MyDbProvider"/>
<property name="MappingAssemblies">
<list>
<value>MyProject.DataAccess.NHibernateMappingLocal</value>
</list>
</property>
Anything should I do for my case? thanks for your help.