xml
u011057506
这个作者很懒,什么都没留下…
展开
-
联合主键
XML配置方法 1.新建一个用于存放联合主键的类. 2.配置映射文件 //新增存放联合主键的类.//需要实现序列化接口,覆盖hashCode和equals方法package com.meiyoudao.domain;import java.io.Serializable;/** * * @author meiyoudao * */public class Per转载 2013-10-06 10:40:21 · 934 阅读 · 0 评论 -
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 · 649 阅读 · 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 · 680 阅读 · 0 评论 -
WARN org.hibernate.util.JDBCExceptionReporter:100 - SQL Error: 1146, SQLState: 42S02
因为hibernate的xml文件中出现了update -->注释去掉变为: update即可原创 2013-10-08 07:29:44 · 2424 阅读 · 0 评论 -
创表语句
@Test public void testSchemaExport() { new SchemaExport(new AnnotationConfiguration().configure()).create(false, true); }相当于xml配置中的:update原创 2013-10-08 17:40:51 · 587 阅读 · 0 评论