![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Hibernate
文章平均质量分 56
y3wegy
这个作者很懒,什么都没留下…
展开
-
Hibernate里面的POJO对象的状态
对于hibernate,它的对象有三种状态:transient、persistent、detached 1.transient:瞬态或者自由态(new DeptPo(1,”行政部”,20,”行政相关”),该po的实例和session没有关联,该po的实例处于transient)2.persistent:持久化状态(和数据库中记录想影射的Po实例,它的状态是persiste转载 2012-08-06 16:14:36 · 840 阅读 · 0 评论 -
Hibatenate 里面的get 和load区别
load和get一共有2个区别 先讲第一个: 延迟加载 load是true而get是false意 思就是 load采用的是延迟加载的方式 而get不是,hibernate思想是 既然这个方法支持延迟加载 他就认为这个对象一定在数据库存在,在你 声明 TFaq tfag2=(TFaq)sess.load(TFaq.class, 300); 这句时候,hibernate就干了一件事 1转载 2012-08-06 16:56:11 · 679 阅读 · 0 评论 -
not found while looking for property错误
最近在研究Hibernate。过程当中碰到了很多问题啊!其中一个就是not found while looking for property错误Caused by: org.hibernate.MappingException: class main.java.POJO.User not found while looking for property: id配置文件如下:转载 2012-08-07 21:24:28 · 15978 阅读 · 7 评论 -
'hibernate.dialect' must be set when no Connection available
出现这个问题的原因是少了一句话:configure();private static SessionFactory buildSessionFactory(){return new Configuration().buildSessionFactory();}应该改成:private static SessionFactory buildSessionFactory()转载 2012-08-07 21:11:46 · 2959 阅读 · 2 评论 -
No CurrentSessionContext configured
最近在学习Hibernate,其中碰到了N多的问题,比如说这个:No CurrentSessionContext configured这个原因主要是配置文件不全导致的如果是java项目,那么就添加;thread如果是web项目,就添加:jta特记于此!以备勿忘!转载 2012-08-07 21:40:53 · 892 阅读 · 0 评论 -
is not mapped [from错误
我出现的错误是:org.hibernate.hql.ast.QuerySyntaxException: loginuser is not mapped [from loginuser]配置文件如下: 代码如下:List list=session.createQuery("from lo原创 2012-08-07 22:53:03 · 66115 阅读 · 12 评论 -
hibernate 联合查询fetch
实体类student@Entitypublic class Student {private int id;private Teacher teacher;private CommonProperty commonProperty;//组件中有两个实体类属性public CommonProperty getCommonProperty() { retur转载 2012-08-23 14:46:37 · 1029 阅读 · 0 评论