HibernateSystemException--ids for this class must be manually assigned before calling save()

来源:互联网 发布:成都华为软件工厂 编辑:程序博客网 时间:2024/05/22 09:44

org.springframework.orm.hibernate3.HibernateSystemException:

 ids for this class must be manually assigned before calling save():adam.bp.workflow.entity.TaResourceassign2;

 nested exception is org.hibernate.id.IdentifierGenerationException: 

ids for this class must be manually assigned before calling save(): adam.bp.workflow.entity.TaResourceassign2


异常的意思是:
adam.bp.workflow.entity.TaResourceassign2 类的id必须在调用save方法之前手工分配,而且这是一个内嵌的异常。

我在这个类对应的TaResourceassign2.hbm.xml中配置的id生成类型是class="assigned",即手工分配,这不存在任何错误--因为我确实是手工分配id的。

通过查证,错误原因有以下几点:
1.此类的id值为空(没有set该值 或 手工生成的值为null)
2.对应的id配置类型以及长度不正确
3.外键关联配置管理的多对一映射,传递的对象为null(导致手工set时为null)
原创粉丝点击