为什么我的hibernate加上begin方法就报错
SessionFactorysf=ac.buildSessionFactory();Sessions=sf.openSession();Transactiontrans=...
SessionFactory sf = ac.buildSessionFactory();
Session s = sf.openSession();
Transaction trans = s.beginTransaction();
trans.begin();
报错:Exception in thread "main" org.hibernate.TransactionException: nested transactions not supported
at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:152)
at com.iflysse.test.TestJD.main(TestJD.java:26) 展开
Session s = sf.openSession();
Transaction trans = s.beginTransaction();
trans.begin();
报错:Exception in thread "main" org.hibernate.TransactionException: nested transactions not supported
at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:152)
at com.iflysse.test.TestJD.main(TestJD.java:26) 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询