这个错误是因为eclipse 

这种jpatools 自动生成的实体类内没把id 设置为自增,还有id的值在生成的时候默认为string 即使加上了也所以无法自增 ,所以还需要把string 换成Integer   ,因为是自增所以无需送数,把后边的getid  setid 删除掉酒可以

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
// private String id;
private Integer id;
//    public Integer  getId() {
// return this.id;
// } // public void setId(String id) {
// Integer it =Integer.valueOf(id);
// //int i = it.intValue();
// this.id = it;
// }

设置自动model时

hibernate save数据的时候报错:ids for this class must be manually assigned before calling save()的更多相关文章

  1. 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 ...

  2. Caused by: org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.qingmu.seller.entity.OrderMaster

    org.springframework.orm.jpa.JpaSystemException: ids for this class must be manually assigned before ...

  3. ids for this class must be manually assigned before calling save():

    Caused by: javax.persistence.PersistenceException: org.hibernate.id.IdentifierGenerationException: i ...

  4. 报错:Caused by: org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): cn.itcast.bos.domain.base.SubArea

    因为 实体类中的主键 是String类型 不能自动为其分配id  所以需要手动设置在service层   model.setId(UUID.randomUUID().toString());

  5. Hibernate: ids for this class must be manually assigned before calling save():

    原文: http://blog.csdn.net/softimes/article/details/7008875 引起问题的原因: 由Hibernate根据数据库表自动生成的"类名.hbm ...

  6. 错误/异常:org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save() 的解决方法

    1.错误/异常视图 错误/异常描述:id的生成错误,在调用save()方法之前,必须先生成id. 2.解决方法     在对应的实体类的主键(id)的get方法上加上:@GeneratedValue( ...

  7. ids for this class must be manually assigned before calling save():Xxx

    把Xxx.hbm.xml主键生成策略改成identity

  8. 记一次 Hibernate 插入数据中文乱码报错解决

    错误描述 程序运行,向表中插入数据(包含中文)报错:\xE6\xB2\x88\xE9\x9B\xAA... 但是自己另外新建一个数据库手动插入数据中文正常,同样修改数据库,表的编码之后同样不行.而且 ...

  9. assigned before calling save & JPA id生成策略

    撸了今年阿里.网易和美团的面试,我有一个重要发现.......>>> Ⅰ 关于JPA 主键,自定义生成遇到的问题,愚蠢的笔记 Ⅱ 第一次 报错: ids for this class ...

随机推荐

  1. SoundManager 2 / API Demo and Code Examples

    http://www.schillmania.com/projects/soundmanager2/

  2. git项目提交后执行添加忽略操作

    需要删除文件暂存区中的忽略文件 git rm -r --cached 需要忽略的已提交文件或文件夹 eg: git rm -r --cached target/

  3. WPF Binding Mode,UpdateSourceTrigger

    WPF 绑定模式(mode) 枚举值有5个1:OneWay(源变就更新目标属性)2:TwoWay(源变就更新目标并且目标变就更新源)3:OneTime(只根据源来设置目标,以后都不会变)4:OneWa ...

  4. HashMap与Hashtable

    1. 1)       Hashtable继承自Dictionary类,HashMap是map接口的一个实现类(继承自AbstractMap抽象类) 2)       在HashMap中,null可以 ...

  5. Git分支merge和rebase的区别

    Git merge是用来合并两个分支的. git merge b # 将b分支合并到当前分支 同样 git rebase b,也是把 b分支合并到当前分支 原理 如下: 假设你现在基于远程分支&quo ...

  6. Linux下Memcached安装与启用

    http://www.linuxidc.com/Linux/2016-07/133423.htm

  7. 小程序获取微信用户的openid

    小程序获取微信用户的openid //index.js //获取应用实例 const app = getApp() Page({ globalData: { appid: '11121221a89e0 ...

  8. spring 之 类型转换 2

    spring内置的转换器 在spring xml 文件中,配置属性的时候, 不管实际是 list 还是map ,还是Date, 或者原生的java 类型, 我们只能配置xml 给它们. 那么 spri ...

  9. leetcode46

    public class Solution { public IList<IList<int>> Permute(int[] nums) { IList<IList< ...

  10. 高性能迷你React框架anujs1.0.8发布

    本版本由于得到业务线同学的大力支持,掀出许多问题,因此改进地方良多,为anujs在完美替换React的道路上前进了不少.现在anujs经测试可以运行于IE7中.至少怎么做可以参看官网,https:// ...