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?
|