AllowCreate Property
Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

HibernateTemplate.AllowCreate Property

Gets or sets if a new Session should be created when no transactional Session can be found for the current thread.

[Visual Basic]
Public Overrides Property AllowCreate() As Boolean
   Public Get
   End Get
   Public Set
   End Set
End Property
public override bool AllowCreate { public get; public set; }

Property Value

true if allowed to create non-transaction session; otherwise, false.


HibernateTemplate is aware of a corresponding Session bound to the current thread, for example when using HibernateTransactionManager. If allowCreate is true, a new non-transactional Session will be created if none found, which needs to be closed at the end of the operation. If false, an InvalidOperationException will get thrown in this case.

See Also

HibernateTemplate Class | Spring.Data.NHibernate.Generic Namespace