这个错误是因为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. mysql 插入更新判断 ON DUPLICATE KEY UPDATE 和 REPLACE INTO

    平时我们在设计数据库表的时候总会设计 unique 或者 给表加上 primary key 的限制条件.此时 插入数据的时候 ,经常会有这样的情况:我们想向数据库插入一条记录: 若数据表中存在以相同主 ...

  2. 使用IDE之webstorm

    最近打算试试用webstorm,今天从vscode换成了webstorm. 官方下载webstorm 1.下载之后安装,我全部选择默认,因为webstorm是付费ide,到启动面板时,选择激活选项. ...

  3. iterator简单描述

    Item 26. Prefer iterator to const iterator, reverse_iterator, and const_reverse_iterator. 上面一段话,是< ...

  4. mass create DN

    RUN VL10 in the background. http://paperstreetenterprises.com/running-vl10-background/ VL10*开头的TCODE ...

  5. docker network基础

    前面介绍了nginx与php两个容器间是如何进行通信的: [root@docker ~]# docker run -d --name=php -v /www:/usr/local/nginx/html ...

  6. Struts2 环境搭建

    1.引入相关struts2 jar包 2.web.xml <?xml version="1.0" encoding="UTF-8"?> <we ...

  7. 字符串String的API

      字符串的理解 1. 字符串的属性 str.length 2. 字符串的方法 charAt() charCodeAt() indexOf() lastIndexOf() slice() substr ...

  8. spring 之 BeanDefinition & BeanDefinitionParser

    xml bean factory 的解析过程的 堆栈大概是这样的: at org.springframework.beans.factory.xml.NamespaceHandlerSupport.f ...

  9. 配置yum源

    本文转载:https://www.cnblogs.com/yangp/p/8506264.html (一)yum源概述 yum需要一个yum库,也就是yum源.默认情况下,CentOS就有一个yum源 ...

  10. http-cookie、session、Token

    无状态  cookie技术的发展 客户端发送请求登录系统 Set-Cookie管理Cookie信息并且返回给客户端 拿着返回的cookie请求Server cookie 管理session 发送登录信 ...