Hibernate报错:XXX for this class must be manually assigned before calling save():
来源:互联网 发布:怎么推广淘宝优惠券 编辑:程序博客网 时间:2024/06/05 05:55
异常信息:
org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save():
异常原因:
<id>元素配置不正确,<id>元素缺少其子元素<generator></generator>的配置。
解决方法:
<id>元素映射了相应数据库表的主键字段,对其子元素<generator class="">,其中class的取值可以为increment、identity、sequence、hilo、native……等,更多的可参考hibernate参考文档,一般取其值为native 。
exp:
<hibernate-mapping>
<class name="com.fqf.Vipdata" table="vipdata" catalog="test">
<id name="vipId" type="java.lang.Integer">
<column name="vipId" />
<generator class="assigned" />
</id>
<property name="vipName" type="java.lang.String">
<column name="vipName" length="20" not-null="true" />
</property>
<property name="vipTitle" type="java.lang.String">
<column name="vipTitle" length="20" not-null="true" />
</property>
</class>
</hibernate-mapping>
看看数据库表中的 id 是不是自增长类型,把<generator class="assigned" />中assigned改为increment
(vipId的类型为自增长)
- Hibernate报错:XXX for this class must be manually assigned before calling save():
- Hibernate报错:XXX for this class must be manually assigned before calling save():
- Hibernate报错:XXX for this class must be manually assigned before calling save():
- hibernate save数据的时候报错:ids for this class must be manually assigned before calling save()
- hibernate save数据的时候报错:ids for this class must be manually assigned before calling save()
- ids for this class must be manually assigned before calling save() hibernate
- org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save():
- 使用hibernate序列号对象到数据库中出现 ids for this class must be manually assigned before calling save()
- ids for this class must be manually assigned before calling save():***错误说明
- error:ids for this class must be manually assigned before calling save():
- error:ids for this class must be manually assigned before calling save()
- ids for this class must be manually assigned before calling save()
- error:ids for this class must be manually assigned before calling save():
- IdentifierGenerationException: ids for this class must be manually assigned before calling save()
- ids for this class must be manually assigned before calling save()..
- HibernateSystemException--ids for this class must be manually assigned before calling save()
- error:ids for this class must be manually assigned before calling save():
- 关于 error:ids for this class must be manually assigned before calling save(): 的解决方案
- android xml界面布局常用属性概括
- OpenGL中启用光照前的准备——指定法线
- 设计模式之验收总结
- 程序员学英语——In November the English learning summary
- 我所收藏的公共DNS
- Hibernate报错:XXX for this class must be manually assigned before calling save():
- DataGridView 列大写、列只能输入数字
- Cadence SPB 16. 6 安装破解步骤
- DataGridView 添加行
- 国内网络用户达4.39亿
- ORACLE中如何输入日期(时间格式)
- Android - ScrollView添加提示Arrow(箭头)
- 关于studio升级到1.0.0-rc4后出现的 “Gradle DSL method not found: 'runProguard()'...”的问题解决方法
- [LeetCode] Pascal's Triangle II