Hibernate Transaction を異なるテーブルで同時に使用する方法は?
1 に答える
0
ドキュメントに示されているように、トランザクションを開始し、必要な数のエンティティで必要なすべてを実行してから、トランザクションをコミットします
// Non-managed environment idiom with getCurrentSession()
try {
factory.getCurrentSession().beginTransaction();
// do some work
...
factory.getCurrentSession().getTransaction().commit();
}
catch (RuntimeException e) {
factory.getCurrentSession().getTransaction().rollback();
throw e; // or display error message
}
于 2012-11-23T08:42:36.523 に答える