-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Transactions on NHibernate
PostPosted: Wed Oct 27, 2010 10:36 am 
Newbie

Joined: Wed Oct 27, 2010 9:40 am
Posts: 1
Hello, I have a question about Transaction.

I need to insert relationated objects.
I have 3 tables and 3 objects mapped.
I have the following case:
....
session = _sessionFactory.OpenSession();
transaction = session.BeginTransaction();

session.save(objeto1);
objeto2.propertyx=administrationobject1.find(id);
session.save(objeto2);
session.save(objeto3);
transaction.Commit();
}
catch
{
if(transaction != null)
transaction.Rollback();
throw;
}
finally
{
if(session != null)
session.Close();
}
If I use a Transaction, i have a problem in this administrationobject1.find(id), because these method use a a new session, and session time expired conection in this method.
Any idea?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.