hibernate
iteye_9434
这个作者很懒,什么都没留下…
展开
-
No row with the given identifier exists
多对多,多对一,一对多关联时:要插入数据,有外键时先检查外键关联的表是否有记录,如果没有,则外键列不要插入任何数据。org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.ambow.lmsx.enrollment.entity.EnrClass#1235]一....原创 2012-05-11 20:14:14 · 126 阅读 · 0 评论 -
@NotFound(action=NotFoundAction.IGNORE)
[quote]转载:http://blog.sina.com.cn/s/blog_7a8f609501014j34.html[/quote]使用hibernate 注解配置实体类的关联关系,在many-to-one,one-to-one关联中,一边引用自另一边的属性,如果属性值为某某的数据在数据库不存在了,hibernate默认会抛出异常。解决此问题,加上如下注解就可以了:@NotFo...原创 2012-06-07 11:10:56 · 256 阅读 · 0 评论 -
line 1:99: unexpected token: null
[list][*]解决:等号后面没有相应的名字[/list][code="java"]String hql= "from EnrChange t where t.enrStudentInfo.fid=:fid and t.fisRemove=";Map filter = new HashMap();filter.put("fid", fid);filter.put("fis...原创 2012-05-17 13:47:33 · 1273 阅读 · 0 评论 -
默认会关联ID
[code="java"] @ManyToOne @JoinColumn(name="FPRJ_CODE") public Project getProject() { return this.project; } public void setProject(Project project) { this.project = project;...原创 2012-05-17 13:47:25 · 103 阅读 · 0 评论 -
could not resolve property: sysMajor.fname
[code="java"]org.hibernate.QueryException: could not resolve property: sysMajor.fname of: com.ambow.lmsx.enrollment.entity.EnrStudentInfo at org.hibernate.persister.entity.AbstractPropertyMappin...原创 2012-05-16 17:30:34 · 100 阅读 · 0 评论 -
many to one could not resolve property
来源:[url]http://michaelfly.iteye.com/blog/772514[/url][code="java"]今天在做一个功能的时候 遇到了。一个Could not resolve property 的问题。 配置文件如下: Java代码 查询代码: Java代码 Criteria crt = session.c...原创 2012-05-16 17:30:23 · 160 阅读 · 0 评论 -
n+1问题
[list][*]http://hi.baidu.com/victorlin23/blog/item/8b7a3382670cd9b16d811963.html[/list][code="java"]Find()方法下FetchType.LAZY、FetchType.EAGER、@Fetch(FetchMode.JOIN)的区别2010-08-27 16:13结论:1.使用例如...原创 2012-05-16 17:30:13 · 254 阅读 · 0 评论 -
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: com.ambow.lmsx.enrollment.entity.EnrStudentInfo column: fclass_code (should be mapped with insert="false" update="fals...原创 2012-05-14 09:02:48 · 128 阅读 · 0 评论 -
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: com.ambow.lmsx.enrollment.entity.EnrStudentInfo column: fclass_code (should be mapped with insert="false" update="fals...原创 2012-05-13 19:17:54 · 291 阅读 · 0 评论 -
ORA-00904: "ENREMPINFO7_"."FSTUDENT_CODE": invalid identifier
ORA-00904: "ENREMPINFO7_"."FSTUDENT_CODE": invalid identifier看清是哪个表出了问题,不然很累ENREMPINFO原创 2012-05-13 19:17:47 · 107 阅读 · 0 评论 -
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.math.BigD
解决:将int类型转成BigDecimal类型就可以了filtrationList.add(new Filtration(MatchType.EQ,BigDecimal.valueOf(0),"fisRemove"));java.lang.ClassCastException: java.lang.Integer cannot be cast to java.math.BigDec...原创 2012-05-13 19:17:40 · 1340 阅读 · 0 评论 -
<转>Hibernate中Criteria的完整用法
Hibernate中Criteria的完整用法 最近在项目中使用 Spring 和 Hibernate 进行开发,有感于 Criteria 比较好用,在查询方法设计上可以灵活的根据 Criteria 的特点来方便地进行查询条件的组装。现在对 Hibernate的Criteria 的用法进行总结: Hibernate 设计了 CriteriaSpecification 作为 ...原创 2012-05-12 08:51:45 · 79 阅读 · 0 评论 -
Hibernate持久化实现
来源[url]http://tenn.iteye.com/blog/104360[/url]一、实体对象的生命周期 1,实体对象的三种状态(生命周期中的三种状态) (1),Transient:在内存中的自由存在,与数据库中的记录无关。 public void methodA{ TUser user = new TUser(); user.setN...原创 2013-03-25 13:58:56 · 92 阅读 · 0 评论