Fight With Me!!!

导航

随笔分类 -  Hibernate

上一页 1 2 3 4 5

hibernate的异常 Session was already closed
摘要:今天写hibernate时候遇到一些异常 代码: 出现异常情况: 出现以上原因是Session关闭 如果不是使用的SessionFactory.getSession()来获得Session。 而是使用SessionFactory.getCurrentSession()方法来获得Session时,当事 阅读全文

posted @ 2014-11-14 09:58 nickTimer

could not resolve property
摘要:could not resolve property(无法解析属性) 顾名思义在写hql语句的时候,属性写错了!请检查大小写,是实体类的,不是数据库表的!一个一个检查,仔细看! 阅读全文

posted @ 2014-11-11 14:13 nickTimer

Null value was assigned to a property of primitive type setter of"原因及解决方法
摘要:在action请求数据的过程中报出"Null value was assigned to a property of primitive type setter of"错误,搜索之后发现是因为数据库里相应的字段为NULL。例如: 其中的类型为hibernate类型,在生成的类中,printTime... 阅读全文

posted @ 2014-11-10 17:36 nickTimer

Hibernate Annotation 设置字段的默认值
摘要:很简单,不过有点莫名其妙的意思@Column(name="powerLoad",columnDefinition="bit(1) default 1 ")private boolean load = true;其实就是在@Column中加入columnDefinition属性里面的值,就是你的字段的... 阅读全文

posted @ 2014-11-10 15:35 nickTimer

Hibernate hql 多表查询
摘要:String hql="select c from Col c ,UserRole role where c.id=role.columnId and c.id=? and role.userId=?";this.getHibernateTemplate().find(hql,new Object[... 阅读全文

posted @ 2014-11-06 15:59 nickTimer

hibernate hql limit的实现方式
摘要:query.setFirstResult(startIndex);//开始索引query.setMaxResults(maxSize);//取几条如 limit 1,5HQL:query.setFirstResult(1);query.setMaxResults(5); 阅读全文

posted @ 2014-11-05 11:39 nickTimer

Null value was assigned to a property of primitive type setter of
摘要:Exception:org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com.vtradex.swms.server.model.recei... 阅读全文

posted @ 2014-11-05 10:49 nickTimer

null id in entry (don't flush the Session after an exception occurs)
摘要:null id in entry (don't flush the Session after an exception occurs) 遇到这个异常实属不小心所致,最初看到异出的错误信息时我误认为是主键为空所致。一着急竟然把entry当成了entity理解,真是让人笑话^_^。 其实个该异常信息... 阅读全文

posted @ 2014-11-04 17:32 nickTimer

HQL中的Like查询需要注意的地方
摘要:public List getOrgan(StringorganCode, StringorganName) { String hsql; List list; if (organCode != null && organCode.length() > 0) { hsql = "from Ab31 ... 阅读全文

posted @ 2014-11-04 14:10 nickTimer

node to traverse cannot be null!
摘要:java.lang.IllegalArgumentException: node to traverse cannot be null! org.hibernate.hql.ast.util.NodeTraverser.traverseDepthFirst(NodeTraverser.java:55... 阅读全文

posted @ 2014-11-04 11:26 nickTimer

hibernate自带的注解和jpa注解的冠希
摘要:hibernate是实现了JPA规范,在我们使用hibernate框架的时候,我们引入了hibernate3或者4这个核心包。hibernate-jpa-2.0-api-1.0.0.Final.jar这个包的作用是hibernatejpa实现。注解的选择,建议采用hibernatejpa,为什么呢,... 阅读全文

posted @ 2014-10-31 16:59 nickTimer

log4j显示hibernate sql参数的配置
摘要:#下面的两条配置非常重要,设置为trace后,将可以看到打印出sql中?占位符的实际内容#thisisthemostimportantconfigforshowingparameslike? log4j中加入下面两条配置:log4j.logger.org.hibernate.SQL=trace lo... 阅读全文

posted @ 2014-10-31 16:42 nickTimer

上一页 1 2 3 4 5