Chinaunix首页 | 论坛 | 博客
  • 博客访问: 30462434
  • 博文数量: 708
  • 博客积分: 12163
  • 博客等级: 上将
  • 技术积分: 8240
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-04 20:59
文章分类

全部博文(708)

分类: Java

2011-09-20 16:51:26

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) |
0

上一篇:hsqldb 日期

下一篇:TestNG

给主人留下些什么吧!~~