![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
hinernate
u011057506
这个作者很懒,什么都没留下…
展开
-
error:org.hibernate.LazyInitializationException: could not initialize proxy - no Session
error:org.hibernate.LazyInitializationException: could not initialize proxy - no Sessionload方法get方法相关代码:@Test public void testTeacherLoad() { Session session = sessionFactory.ge原创 2013-10-07 11:53:49 · 641 阅读 · 0 评论 -
联合主键
XML配置方法 1.新建一个用于存放联合主键的类. 2.配置映射文件 //新增存放联合主键的类.//需要实现序列化接口,覆盖hashCode和equals方法package com.meiyoudao.domain;import java.io.Serializable;/** * * @author meiyoudao * */public class Per转载 2013-10-06 10:40:21 · 912 阅读 · 0 评论 -
WARN org.hibernate.util.JDBCExceptionReporter:100 - SQL Error: 1146, SQLState: 42S02
因为hibernate的xml文件中出现了update -->注释去掉变为: update即可原创 2013-10-08 07:29:44 · 2413 阅读 · 0 评论 -
灵活更新部分更改的字段
一、使用 HQL(EjBQL):@Test public void testUpdate7() { Session session = sessionFactory.getCurrentSession(); session.beginTransaction(); Query q = session.createQuery("update student s s原创 2013-10-08 11:31:55 · 674 阅读 · 0 评论 -
org.hibernate.MappingException: Unknown entity常见问题(新手需注意)
import javax.persistence.Id;import javax.persistence.Table;import javax.persistence.Transient;import org.hibernate.annotations.Entity;//这是就出问题了哦@Entity@Table(name="test_person")public class Per转载 2013-10-09 10:45:43 · 721 阅读 · 0 评论 -
创表语句
@Test public void testSchemaExport() { new SchemaExport(new AnnotationConfiguration().configure()).create(false, true); }相当于xml配置中的:update原创 2013-10-08 17:40:51 · 575 阅读 · 0 评论 -
java.lang.NoSuchMethodError: javax.persistence.OneToOne.orphanRemoval()Z
一个简单一对一联系 两个类 其中一个用了@OnetoOne 注解错误提示:Exception in thread "main" java.lang.NoSuchMethodError: javax.persistence.OneToOne.orphanRemoval()Zat org.hibernate.cfg.AnnotationBinder.processElement转载 2013-10-09 07:09:51 · 528 阅读 · 0 评论