anthony wrote:
what?
are you talking about insert table (insert into....) or persisting new instances? (session.save, session.create, or maybe dao.save)?
Hi anthony
I use JTA Transaction.
But it can't insert data using the following code:
Code:
UserTransaction utx=......................
doInsertItem(item1);
doUpdateItem(item2);
utx.commit().
.......................................
The two method is:
Code:
public void doInsertItem(Object item){
Session s=HibernateUtil.currentSession();
s.save(item);
HibernateUtil.closeSession();
}
public void doUpdateItem(Object item){
Session s=HibernateUtil.currentSession();
item.set.....
. .......................
s.update(item);
HibernateUtil.closeSession();
}
This method can't insert and update database.Why? If I commit transaction in two method,it can't be in the same transaction. How to do it correctly?
Thks[/code]