org.hibernate.HibernateException:createCriteria is not valid without active transaction\x05at org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:348)\x05at $Proxy119.createCrite

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/25 05:51:02
org.hibernate.HibernateException:createCriteriaisnotvalidwithoutactivetransaction\x05atorg.hibernate

org.hibernate.HibernateException:createCriteria is not valid without active transaction\x05at org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:348)\x05at $Proxy119.createCrite
org.hibernate.HibernateException:createCriteria is not valid without active transaction
\x05at org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:348)
\x05at $Proxy119.createCriteria(Unknown Source)
\x05at com.wyb.dao.impl.EntityDaoImpl.createCriteria(EntityDaoImpl.java:146)
\x05at com.wyb.dao.impl.EntityDaoImpl.loadByProperty(EntityDaoImpl.java:127)
\x05at com.wyb.biz.impl.UserEntityBizImpl.load(UserEntityBizImpl.java:18)
\x05at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

org.hibernate.HibernateException:createCriteria is not valid without active transaction\x05at org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:348)\x05at $Proxy119.createCrite
当 Hibernate 和 Spring 整合时,在 Spring 中指定的 Hibernate.cfg.xml 文件内容中要注释掉以下内容:
\x09