Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

SessionFactoryUtils.GetNewSession Method

Get a new Hibernate Session from the given SessionFactory. Will return a new Session even if there already is a pre-bound Session for the given SessionFactory.

[Visual Basic]
Public Shared Sub GetNewSession( _
   ByVal sessionFactory As ISessionFactory, _
   ByVal interceptor As IInterceptor _
)
[C#]
public static ISession GetNewSession(
   ISessionFactory sessionFactory,
   IInterceptor interceptor
);

Parameters

sessionFactory
The session factory to create the session with.
interceptor
The Hibernate entity interceptor, or
null
if none.

Return Value

The new session.

Remarks

Within a transaction, this method will create a new Session that shares the transaction's ADO.NET Connection. More specifically, it will use the same ADO.NET Connection as the pre-bound Hibernate Session.

Exceptions

Exception Type Condition
DataAccessResourceFailureException If could not open Hibernate session

See Also

SessionFactoryUtils Class | Spring.Data.NHibernate Namespace