hibernate异常:org.hibernate.id.…

来源:互联网 发布:nginx 配置文件服务器 编辑:程序博客网 时间:2024/06/07 19:16
  今天在做hibernate练习时出现了一个异常,现在分享如下:

异常信息:org.hibernate.id.IdentifierGenerationException:ids for this class must be manually assigned before callingsave():

解决方法:元素映射了相应数据库表的主键字段,对其子元素,其中class的取值可以为increment、identity、sequence、hilo、native......等,这里由于id是主键所以class取值为:increment(单词意思是增长)


0 0