Hi all
I have a problem in the following situation:
I have two persistant classes vwTransaction and Transaction. The first one is populated from the view vwTransactions, the second - from table Transactions.
To populate the view data on the screen I'm using vwTransaction, and on the update statement, I'm using Transaction.
public void FillObject(int tranID)
{
ITransaction tx = FactorySession.BeginTransaction();
VwTransaction lVwTransaction = FactorySession.Load(typeof(VwTransaction), tranID) as VwTransaction;
FactorySession.Flush();
tx.Commit();
//....init UI controls with data from lVwTransaction
}
public void Save()
{
Transaction tran = FactorySession.Load(typeof(Transaction), CurrentEntity.ID);
//....source to change the fields of tran object
tx=FactorySession.BeginTransaction();
FactorySession.SaveOrUpdate(tran);
tx.Commit();
}
FactorySession - ISession, stored in the Session of the ASP user.
When the tx.Commit is run the error occurs: "can't update object vwTransaction [SQL Statement: UPDATE vwTransaction SET ....]". But I don't want to update this object - I want to update Transaction!!! Why this happens?
In the ASP Page the FillObject is in the method Page_Load occurs on any postback event. I think I have to clean up somehow the select statements againts the previous object before to run the update. But what I have to do? Close the session?
Thanks in advance for your help
Hibernate version: 1.2.0
|