hibernatepe配置文件:
<class name= "com.ll.model.Ware " table= "ware " schema= "dbo " catalog= "vod ">
<id name= "wid " type= "java.lang.Integer ">
<column name= "wid " />
<generator class= "assigned " />
</id>
解决办法:
assigned是自动增长的varchar型的。
如果你的主键时自动增长的Int型,把你的assigned改成自动增长的Identity,increament等自动增长类型为int的
<class name= "com.ll.model.Ware " table= "ware " schema= "dbo " catalog= "vod ">
<id name= "wid " type= "java.lang.Integer ">
<column name= "wid " />
<generator class= "assigned " />
</id>
解决办法:
assigned是自动增长的varchar型的。
如果你的主键时自动增长的Int型,把你的assigned改成自动增长的Identity,increament等自动增长类型为int的
本文介绍了一个关于 Hibernate 配置文件中主键设置的问题及其解决方案。当使用 assigned 作为主键生成策略时,若主键为自动增长的 Int 类型,则需要更改为 Identity 或 increment 等适用于整数类型的自动增长策略。
1804

被折叠的 条评论
为什么被折叠?



