New to (n)hibernate. Trying it out for a big project and here's the method:
Code:
public void Save(Customer customer)
{
using( ITransaction transaction = DataAccessLayer.Instance.ActiveSession.BeginTransaction())
{
try
{
customer.Company.Address.LastUpdated = DateTime.Now;
customer.Company.PrimaryContact.LastUpdated = DateTime.Now;
DataAccessLayer.Instance.ActiveSession.SaveOrUpdate( customer );
transaction.Commit();
}
catch(Exception e)
{
transaction.Rollback();
throw new ApplicationException("Unable to save customer.", e);
}
}
}
If it's followed at some point during request process by :
Code:
DataAccessLayer.Instance.ActiveSession.CreateCriteria( typeof(Customer) ).List();
BatcherImpl.cs "
void Prepare( IDbCommand command )" tries to do this:
Code:
if( session.Transaction != null )
{
session.Transaction.Enlist( command );
}
At which point the transaction has been disposed of and the session.Transaction throws the exception.
Am I missing something or it's a bug?
On the side note, do I need an explicit transaction to save the hierarchy?
TIA,
Eugene.