javax.persistence.PersistenceException
来源:互联网 发布:淘宝仅退款规则 编辑:程序博客网 时间:2024/06/05 10:03
(非原创,环境Play+Ebean ,新增加int 字段,出异常如下)
遇到一个奇怪的问题报错如下:
[error] application -
! @6og7253b0 - Internal server error, for (GET) [/] ->
不进入方法,查找资料发现问题出在数据库上.
javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of......
原因:bean中新添加的字段是int类型
private int employeeid;@Column(name=calendar_employeeid)public intgetEmployeeId() {return employeeId;}public void setEmployeeId(int employeeId) {this.employeeId = employeeId;}
当数据库中该字段为null时,就会报错
解决方法1:该bean 中相应字段int 改为Integer
@Column(name=calendar_employeeid)public Integer getEmployeeId() {return employeeId;}public void setEmployeeId(Integer employeeId) {this.employeeId = employeeId;}
解决方法2:数据库中相应字段默认不为null
0 0
- javax.persistence.PersistenceException 异常
- javax.persistence.PersistenceException
- javax.persistence.PersistenceException: invalid persistence.xml
- javax.persistence.PersistenceException: org.hibernate.PropertyAccessException
- javax.persistence.PersistenceException: No Persistence provider for EntityManager named ***
- javax.persistence.PersistenceException: No Persistence provider for EntityManager named ***
- javax.persistence.PersistenceException: No Persistence provider for EntityManager named ***
- javax.persistence.PersistenceException: No Persistence provider for EntityManager named userPU
- javax.persistence.PersistenceException: No Persistence provider for EntityManage
- javax.persistence.PersistenceException: [PersistenceUnit: cmf.server] Unable to build EntityManagerF
- javax.persistence.PersistenceException: [PersistenceUnit: klmsdb] Unable to build EntityManagerFacto
- hibernate实现jpa文档,persistence.xml配置问题(javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Canno
- javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not execute query
- Caused by: javax.persistence.PersistenceException: [PersistenceUnit: SimpleTe] Unable to build Entit
- 解决Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibe
- javax.persistence 用法
- NoClassDefFoundError: javax/persistence/Cacheable
- javax.persistence.Cacheable
- 类名前自动添加前缀
- 白话经典算法系列之一 冒泡排序的三种实现
- 每天一个Linux命令(1) ls
- iOS 数据存储的几种方式
- dpkg 用法
- javax.persistence.PersistenceException
- 最近遇到的一些错误,以解决,进行记录
- 欢迎使用CSDN-markdown编辑器
- iOS开发 - 分享功能
- iOS调用系统设置的命令
- MATLAB知识:varargin是个什么东东??
- Move Zeroes 去除0且按照原来顺序返回
- 1.0.1(viewpager)
- ANT打jar包