Exception in thread "main" org.hibernate.TransactionException: Transaction not successfully started解
来源:互联网 发布:wps office for mac 编辑:程序博客网 时间:2024/05/16 09:22
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:131)
at entity.Test.show(Test.java:46)
at entity.Test.main(Test.java:18)
遇到这个问题的时候还以为是xml这些错,但是控制台能正常输出,后检查一下是一些很粗心的小错误。
(1)首先检查Employee中定义的是hiredate,但报的是hirenate没有getter方法
(2)当session这些语句错误执行错误也会报错。如查询方法:查询信息无需开启还有执行session的,注释掉就没有报错了。
//查询班级中的学生信息
public static void show(){
Session session=HibernateSessionFactory.getSession();
Grade grade=(Grade)session.get(Grade.class,8);
System.out.println(grade.getGname()+",详细信息:"+grade.getGdesc());
//找出包含学生的信息,已经创建单项一对多的关系
Set<Student> students=grade.getStudents();
System.out.println(grade.getStudents());
for(Student stu:students){
System.out.println("学生名称:"+stu.getSname()+",学生性别: "+stu.getSex());
}
// session.getTransaction().commit(); / /提交事务 查询信息无需开启还有执行session的,注释掉就没有报错了。
session.close();
}
- Exception in thread "main" org.hibernate.TransactionException: Transaction not successfully started解
- org.hibernate.TransactionException: Transaction not successfully started
- org.hibernate.TransactionException: Transaction not successfully started
- 出现org.hibernate.TransactionException: Transaction not successfully started的原因
- 出现org.hibernate.TransactionException: Transaction not successfully started
- hibernate 事务嵌套导致org.hibernate.TransactionException: Transaction not successfully started
- Exception in thread "main" org.hibernate.TransactionException: commit failed
- Hibernate 错误解决(TransactionException: Transaction not successfully started)
- 解决方法 严重: Servlet.service() for servlet default threw exception org.hibernate.TransactionException: Transaction not successfully
- Exception in thread "main" org.hibernate.MappingNotFoundException
- Exception in thread "main" org.hibernate.MappingException
- Transaction not successfully started
- Transaction not successfully started
- Transaction not successfully started
- Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: JDBC rollback failed
- Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: J
- Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not fetch initial valu
- 学Hibernate报:Exception in thread "main" org.hibernate.LazyInitializationException: could not initiali
- iOS之Block报错:capturing self strongly in this block is likely to lead to a retain cycle
- cshi
- Unity UGUI之Canvas总结
- Android自定义控件,有关于matrix超详细使用教程及进阶
- VS2005(VC++)远程调试方法搜集
- Exception in thread "main" org.hibernate.TransactionException: Transaction not successfully started解
- codeforces 348 C. Subset Sums (暴力+技巧)
- Redux Thunk
- Android代码优化之去除未使用资源
- 【李木华】二叉树的一般概念
- Nginx启动时error while loading shared libraries: libcrypto.so.1.1
- 给 Gradle 初学者的 知识普及 http://mp.weixin.qq.com/s?__biz=MzA4NTQwNDcyMA==&mid=2650661971&idx=1&sn=3fb69537
- java保留后两位小数
- shell 监控服务器负载