Exception in thread "main" org.springframework.orm.hibernate3.HibernateSystemException: identifier of an instance of cn.qbq.web.entity.Project was altered from 0 to 0; nested exception is org.hibernate.HibernateException: identifier of an instance of cn.qbq.web.entity.Project was altered from 0 to 0
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAcces***ception(SessionFactoryUtils.java:679)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAcces***ception(HibernateAccessor.java:412)Hibernate:
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:912)
at cn.qbq.web.dao.ProjectDao.getAllProjects(ProjectDao.java:15)
at cn.qbq.test.Test.main(Test.java:19)
Caused by: org.hibernate.HibernateException: identifier of an instance of cn.qbq.web.entity.Project was altered from 0 to 0
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:85)
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:190)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:147)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
at org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:390)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:407)
... 4 more
请检查Project类的主键属性是否是封装类型。例如:Integer,Long ……。不能是int,long等数据类型。
阅读(5880) | 评论(0) | 转发(0) |