org.hibernate.id.IdentifierGenerationException错误解决方法
org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save():
ID主键生成策略为assigned 由应用程序负责生成主键标识符
<id name="id" type="java.lang.String">
<column name="ID" length="32" />
<generator class="assigned" />
</id>
而在保存时没有设置ID
session.save(entity);
导致出现此错误
解决方法:
1、在保存时手动设置个ID就可以:
entity.setId(UUID.randomUUID().toString());
session.save(entity);
2、改动主键生成策略为其它
作者:itmyhome
org.hibernate.id.IdentifierGenerationException错误解决方法的更多相关文章
- org.hibernate.id.IdentifierGenerationException: Hibernate异常
异常信息: org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned b ...
- C#常见错误解决方法
1.能提供Visual Studio开发工具包吗? 解决方法: Visual Studio 2017开发环境下载地址: https://www.visualstudio.com/zh-hans/dow ...
- org.hibernate.id.IdentifierGenerationException
[问题]org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned bef ...
- Linux遇到的问题(一)Ubuntu报“xxx is not in the sudoers file.This incident will be reported” 错误解决方法
提示错误信息 www@iZ236j3sofdZ:~$ ifconfig Command 'ifconfig' is available in '/sbin/ifconfig' The command ...
- 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 ...
- SQL SERVER 9003错误解决方法 只适用于SQL2000
SQLSERVER 9003错误解决方法 只适用于SQL2000 (只适用于SQL2000) "无法打开新数据库 'POS'.CREATE DATABASE 中止. (Microsoft S ...
- New XAMPP security concept:错误解决方法
New XAMPP security concept:错误解决方法 (2014-03-06 16:07:46) 转载▼ 分类: php 在Linux上配置xampp后远程访问域名报错: New X ...
- hadoop本地库与系统版本不一致引起的错误解决方法
hadoop本地库与系统版本不一致引起的错误解决方法 部署hadoop的集群环境为 操作系统 centos 5.8 hadoop版本为cloudera hadoop-0.20.2-cdh3u3 集 ...
- mysql Access denied for user root@localhost错误解决方法总结(转)
mysql Access denied for user root@localhost错误解决方法总结(转) mysql Access denied for user \'root\'@\'local ...
随机推荐
- pytorch使用过程中遇到的一些问题
问题一 ImportError: No module named torchvision torchvison:图片.视频数据和深度学习模型 解决方案 安装torchvision,参照官网 问题二 安 ...
- 关于JS正则表达式
去除所有P标签 content=content.replace(/<([\/]?)(p)((:?\s*)(:?[^>]*)(:?\s*))>/g, ''); 将所有的 1. ...
- [ZJOI2007]时态同步 (树形DP)
题目描述 小 Q在电子工艺实习课上学习焊接电路板.一块电路板由若干个元件组成,我们不妨称之为节点,并将其用数字 1,2,3-.进行标号.电路板的各个节点由若干不相交的导线相连接,且对于电路板的任何两个 ...
- P2389 电脑班的裁员 (动态规划)
题目背景 隔壁的新初一电脑班刚考过一场试,又到了BlingBling的裁员时间,老师把这项工作交给了ZZY来进行.而ZZY最近忙着刷题,就把这重要的任务交(tui)给了你. 题目描述 ZZY有独特的裁 ...
- miller_rabin + pollard_rho模版
#include<stdio.h> #include<stdlib.h> #include<time.h> #include<math.h> #incl ...
- pl/sql小技巧
更正方法: 然后把Automatic statistics的勾选去掉,点击apply即可
- android获取手机号
private String getPhoneNum(){ //与手机建立连接 TelephonyManager tm = (TelephonyManager)getSystemService(Con ...
- koa2 从入门到进阶之路 (一)
首先我们先来了解一下 Koa 是什么,https://koa.bootcss.com/,这是 Koa 的官方网站,映入眼帘的第一句就是 Koa -- 基于 Node.js 平台的下一代 web 开发框 ...
- 字符串哈希hash
题目描述 如题,给定N个字符串(第i个字符串长度为Mi,字符串内包含数字.大小写字母,大小写敏感),请求出N个字符串中共有多少个不同的字符串. 友情提醒:如果真的想好好练习哈希的话,请自觉,否则请右转 ...
- delphi中Record 和Packed Record的区别
Record 和Packed Record 第一种不带packed关键字的结构体表明编译器编译时要求进行字对齐,而第二种带packed关键字的结构体表明编译器编译该结构体时不需要进行字对齐,这种方式对 ...