我执行hibernate语句的时候报了一个错误。
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: insert into DEPT (dname, loc, DEPTNO) values (?, ?, ?)
Hibernate: insert into EMP (ename, job, mgr, sal, comm, deptno, EMPNO) values (?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into EMP (ename, job, mgr, sal, comm, deptno, EMPNO) values (?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into EMP (ename, job, mgr, sal, comm, deptno, EMPNO) values (?, ?, ?, ?, ?, ?, ?)
Exception in thread "main" org.hibernate.TransactionException: Transaction not successfully started
at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:149)
at many_to_one.Test.main(Test.java:31)

但是我查询数据库的时候,里面已经执行了,并且有了数据。 但是后台报了一个错误。 我将异常代码catch后,为什么没有回滚。catch(Exception ex){
ex.printStackTrace();
}finally{
trans.rollback();
}