![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
hibernate4
Green_1001
这个作者很懒,什么都没留下…
展开
-
hibernate4 异常
最近学习hibernate4遇到的问题记录一下,数据库使用 的是mysql5.6.231.Exception in thread "main" org.hibernate.MappingException: Could not instantiate id generator [entity-name=com.share.domain.User]at org.hibernate.id...原创 2015-05-18 00:05:24 · 109 阅读 · 0 评论 -
org.hibernate.MappingException: Unknown entity
最近使用hibernate4注解写demo的时候出现了org.hibernate.MappingException: Unknown entity一般原因是注解@Entity引入包错误,这儿使用注解应该是import javax.persistence.Entity;不是hibernate下的,另外就是映射错误 上面 的红框中的需要写具体的包名,同一包下的实体不能为了省事使用*代替,...原创 2015-09-27 10:14:40 · 202 阅读 · 0 评论 -
hibernate4 identifier of an * cn.gov.share.Item was altered from 12 to 23
最近在项目开发中突然遇到一个之前没有遇到的问题identifier of an instance of com.gov.share.Item was altered from 12 to 23的错误,debug调试也没有找到对应的id,之后网上搜索了一下基本上都是说是hibernate实体定义的类型与数据库定义的类型不一致导致的, 我检查了我代码与数据库,类型一致...2015-11-08 22:49:13 · 133 阅读 · 0 评论 -
hibernate4 Oracle executeQuery()方法执行删除无法删除数据库数据
项目开发中,使用的hibernate oracle删除数据时使用以下代码不能删除数据 public void delPerson(String name) { Session session = HibernateUtil.currentSession(); String hql = "delete f...2015-11-08 23:09:23 · 497 阅读 · 0 评论 -
hibernate4 detached entity passed to persist
最近工作中持久化对象时总是报错detached entity passed to persist,查了数据库中id生成策略和数据库是自动递增的,首先排除是id策略引起的,然后检查程序也没有setId,排除了id相关的问题,另外set get方法使用的lombok框架的@Getter @Setter注解,排除get set的问题,让同事看了一下,发现字段属性有基本数据类型,改为对象类型了还是不行,...原创 2017-05-21 20:56:29 · 171 阅读 · 0 评论 -
hibernate4 oracle查询数字溢出
最近在使用hibernate进行oracle数据库查询时遇到一个错误:“数字溢出”,网上查找资料很多都说数字长度问题,但是使用同样的sql查询数据库是没有错误,最后发现是实体映射时一些字段使用的Integer导致的,数值长度太长导致的。...原创 2016-03-24 19:09:10 · 738 阅读 · 0 评论 -
Parameter with that position [1] did not exist
今天项目中用hibernate遇到下面错误Parameter with that position [1] did not exist hql查询Query query=this.GetSession().createQuery("from Stu where SName in (?)", sname); 当时sname传入的参数值为 zhangsan,lisi,wang...2018-06-06 18:45:47 · 4809 阅读 · 0 评论