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 ...
随机推荐
- C++中的临时变量
临时变量有两个特征: 1.invisiable,在程序代码中没有显式出现 2 没有名字 non - named. 出现临时变量/对象的场合1.函数的返回值2. 参数传递 值传递 by - value ...
- PHP 判断表单提交的file是否为空
echo '<pre>'; var_dump($product_attach_files); echo "</pre>"; echo ];
- 信安实验-RC4加密算法
RC4加密算法 算法具体就不介绍了,应信安老师要求整理及掌握. #include<bits/stdc++.h> using namespace std; const int N=256; ...
- javascript数组学习1
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- Android点击两次返回退出程序
代码改变世界 Android点击两次返回退出程序 private long mExitTime; public boolean onKeyDown(int keyCode, KeyEvent even ...
- POJ 1038 Bugs Integrated, Inc. ——状压DP
状态压缩一下当前各格子以及上面总共放了几块,只有012三种情况,直接三进制保存即可. 然后转移的时候用搜索找出所有的状态进行转移. #include <map> #include < ...
- LightOJ1106 Gone Fishing
Gone Fishing John is going on a fishing trip. He has h hours available, and there are n lakes in the ...
- asp.net mvc 页面内容呈现Html.Raw HtmlString
asp.net mvc 页面内容呈现Html.Raw Html.Raw内容经过页面呈现,不呈现Html标签 @Html.Raw( File.ReadAllText(Server.MapPath(&qu ...
- codevs——1294 全排列
1294 全排列 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题解 查看运行结果 题目描述 Description 给出一个n, 请输出n的所有全 ...
- Jetson TK1 一:调整屏幕分辨率
先点击分辨率调整的那个对话框,就是1024×768之类的那个,选定一个分辨率,我选的是1366x768(16:9)的那个,然后连续按7下tab按键,然后回车,然后再点击弹出的选项右边一个就能保存了.