Hibernate报错:org.hibernate.id.IdentifierGenerationException:ids for this class must be manually assig
来源:互联网 发布:mysql 两个表的合集 编辑:程序博客网 时间:2024/05/16 05:01
org.hibernate.id.IdentifierGenerationException:ids for this class must be manually assigned before calling save()
hibernate出现这个错误的原因有可能因为,你的表中有个主键。 但是你插入的(调用save)时那个值是null
你要操作的数据表中的id(即主键)的类型设置成了“自动增长类型”,而在你的
hibernate.cfg.xml中,id的生成方式是assigned,即
- <id name="id" type="integer">
- <column name="id" />
- <generator class="assigned" />
- </id>
解决方法:
把主键的生成方式改为native,它的特征是能够根据底层数据库自动选择主键生成方式
即
- <id name="id" type="integer">
- <column name="id" />
- <generator class="native" />
- </id>
- Hibernate报错:org.hibernate.id.IdentifierGenerationException:ids for this class must be manually assig
- org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling
- org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save():
- org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before
- org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before
- org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before
- org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before
- org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before
- 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()
- IdentifierGenerationException: ids for this class must be manually assigned before calling save()
- ids for this class must be manually assigned before calling save() hibernate
- hibernate保存数据的时候出现:ids for this class must be manually assigned before 错误
- 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序列号对象到数据库中出现 ids for this class must be manually assigned before calling save()
- ids for this class must be manually assigned before calling save(): org.lee.model.UserHibernate
- javaMail发送QQ邮件
- Android模拟器上不了网的解决办法
- js里面的变量作用域
- PNG透明背景按钮的实现
- 银行科技与业务融合之道
- Hibernate报错:org.hibernate.id.IdentifierGenerationException:ids for this class must be manually assig
- 省市县三级联动(第三种方法)的优化
- 16进制字符串转换为整型
- 读《写给24岁的我》的感想
- .net 操作XML小结
- 获得命令的输出结果
- VMware9虚拟机安装MAC OS X Mountain Lion详细图文教程[亲自测试]
- C++编程思想--初始化与清除
- 全排列的算法思想和实现