ids for this class must be manually assigned before calling save():
2012-07-25 09:39
337 查看
ids for this class must be manually assigned before calling save():
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的类型为自增长) |
相关文章推荐
- org.hibernate.id.IdentifierGenerationException: 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()
- ids for this class must be manually assigned before calling save():
- error:ids for this class must be manually assigned before calling save()
- org.hibernate.id.IdentifierGenerationException: 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():
- 【转】 ids for this class must be manually assigned before calling save()
- hibernate save数据的时候报错: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()
- ids for this class must be manually assigned before calling save()..
- ids for this class must be manually assigned before calling save():
- 【转】 ids for this class must be manually assigned before calling save()
- ids for this class must be manually assigned before calling save()..
- ids for this class must be manually assigned before calling save()
- ids for this class must be manually assigned before calling save(): com
- Hibernate报错:org.hibernate.id.IdentifierGenerationException:ids for this class must be manually assigned before calling save()
- ids for this class must be manually assigned before calling save():