org.hibernate.id.IdentifierGenerationException: Hibernate异常
异常信息:
org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.geore.pojo.linkman.LinkMan
at org.hibernate.id.Assigned.generate(Assigned.java:34)
上面的异常信息显示在com.geore.pojo.linkman.LinkMan中的id值,在save()方法调用之前,必须手动的输入。那么造成这个的原因可能就是在Hibernate的实体类的xml的配置中对于主键的生成策略没有配置。因此有可能导致出现这样的问题。
出错代码:
<id name="lid" column="lid"></id>
正确配置:
<id name="lid" column="lid">
<generator class="uuid"></generator>
</id>
所以解决的方案就是在Hibernate的实体类的配置文件中给出主键的生成策略(如上)或者另一种解决的办法,主键不通过Hibernate生成,由自己给出,如下:
linkman.setLid(UUID.randomUUID().toString().replace("-", ""));
org.hibernate.id.IdentifierGenerationException: Hibernate异常的更多相关文章
- 异常:org.hibernate.id.IdentifierGenerationException
在有关联关系的数据表中保存数据时,先保存一端,再保存多端的抛出的异常(此时不管一端,还是多端的对象都没有设置id,属性,也就是要保存的两个对象的id 属性为空.) org.hibernate.id.I ...
- org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.String
org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.Strin ...
- org.hibernate.id.IdentifierGenerationException
[问题]org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned bef ...
- 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 ...
- org.hibernate.id.IdentifierGenerationException错误解决方法
org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before ...
- 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 ...
- 错误/异常:org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save() 的解决方法
1.错误/异常视图 错误/异常描述:id的生成错误,在调用save()方法之前,必须先生成id. 2.解决方法 在对应的实体类的主键(id)的get方法上加上:@GeneratedValue( ...
- 报错: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());
- hibernate 出现Caused by: java.sql.SQLException: Column 'id' not found.异常
用hibernate进行映射查询时,出现Caused by: java.sql.SQLException: Column 'id' not found 异常,检查数据库表及映射都有id且已经正确映射, ...
随机推荐
- A.Equivalent Prefixes
题目大意:等价数组定义为(1≤l≤r≤m)中,所有的子区间都满足最小值下标相等,找出最大的m. 题解:我们要找到最大的m,就要保证两个数组的所有子区间最小值下标相等 所以用一个单调栈来维护一个单调递增 ...
- Hls平台实现sobel算法(一)
索贝尔(Sobel)算子主要用于边缘检测,根据像素点的上下.左右邻点的灰度加权差与阈值进行比较,在边缘处达到极值的方法实现边缘检测. -------------序 一.原理性运行 流水线操作,将输入图 ...
- WinForm:如何在ListBox中添加CheckBox
http://www.cnblogs.com/myshell/archive/2010/09/24/1834184.html 最近因为做WinForm的项目,遇到这个问题,当时以为CheckedLis ...
- ASP.NET Core 2.2 : 二十六. 应用JWT进行用户认证及Token的刷新
来源:https://www.cnblogs.com/FlyLolo/p/ASPNETCore2_26.html 本文将通过实际的例子来演示如何在ASP.NET Core中应用JWT进行用户认证以及T ...
- k3 cloud列表中出现很多空白
解决办法:找到单据体:过滤面板默认隐藏打勾
- vue路由的两种模式配置以及history模式下面后端如何配置
vue路由的两种模式配置以及history模式下面后端如何配置 1.hash ——即地址栏URL中的#符号.hash 虽然出现URL中,但不会被包含在HTTP请求中,对后端完全没有影响,因此改变has ...
- [好好学习]在VMware中安装Oracle Enterprise Linux (v5.7) - (1/5)
在想到Oracle Enterprise Linux,第一时间就是在Oracle官网上找到资源,但是,出现以下图片
- STM32之模拟串口设计
一.设计用途: 公司PCB制成板降成本,选择的MCU比项目需求少一个串口,为满足制成板成本和项目对串口需求,选择模拟一路串口. 二.硬件电路: 三.设计实现: 工具&软件:STM32F030R ...
- PHP实现session共享
通过修改PHP-FPM配置文件,实现session会话共享: - 配置PHP使用memcached服务器共享Session信息 - 客户端访问两台不同的后端Web服务器时,Session 信息一致 环 ...
- [Poj2349]Arctic Network(二分,最小生成树)
[Poj2349]Arctic Network Description 国防部(DND)要用无线网络连接北部几个哨所.两种不同的通信技术被用于建立网络:每一个哨所有一个无线电收发器,一些哨所将有一个卫 ...