Hibernate wascommitted method: judge whether the transaction is committed
•
Java
wasCommitted()
Example
session.saveOrUpdate(uf); //调用插入数据方法 if(tx.wasCommitted()){ //判断事务是否已经被提交 System.out.println("事务已经被提交"); }else{ System.out.println("事务没有被提交"); } tx.commit();//提交事务 if(tx.wasCommitted()){ System.out.println("事务已经被提交"); }else{ System.out.println("事务没有被提交"); }
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码