![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
hibernate
打发时间的coder
人这一辈子,大部分都在打发时间
展开
-
org.hibernate.LazyInitializationException - could not initialize proxy - no Session问题的解决
org.hibernate.LazyInitializationException - could not initialize proxy - no Session问题的解决: 原因:懒加载问题 解决办法:将*.hbm.xml文件中的中的lazy="false"设置上,避免懒加载。原创 2017-05-21 14:41:22 · 385 阅读 · 0 评论 -
异常:org.hibernate.hql.ast.QuerySyntaxException: EmpModel is not mapped [from EmpModel where name = ?
异常: org.hibernate.hql.ast.QuerySyntaxException: EmpModel is not mapped [from EmpModel where name = ? and pwd = ?] 原因: 实体类缺少映射文件 解决办法: 补充实体类的映射文件 实体类.hbm.xml原创 2017-07-23 16:44:15 · 514 阅读 · 0 评论 -
Hibernate个别主键生成策略
1、assigned 主键由外部程序负责生成,在 save() 之前必须指定一个。Hibernate不负责维护主键生成。与Hibernate和底层数据库都无关,可以跨数据库。在存储对象前,必须要使用主键的setter方法给主键赋值,至于这个值怎么生成,完全由自己决定,这种方法应该尽量避免。 generator class="assigned" /> “ud”是自定义的策略名,转载 2017-09-06 22:07:40 · 173 阅读 · 0 评论