
Hibernate
绝尘的绝
作品才是你的名片
展开
-
[hibernate3-摘要]第2节:Hibernate核心应用之Session类的函数
#【openSession和getCurrentSession的区别】<1> 生成的session实例。 openSession生成的Session的实例是SessionImpl的实例; getCurrentSession生成的是代理对象$Proxy<2> 新旧session实例。 openSession每次打开都是新新Session; ...2013-04-27 19:25:12 · 120 阅读 · 0 评论 -
[hibernate3-摘要] 第一节:JPA注解
[hibernate3-摘要]第一节:JPA注解@Entity 【类声明】 注解为ORM对象@Table 【类声明】 指定数据库表信息:@Table(name="t_student")指定表名@Id 【get方法声明】 类的主属性@GeneratedValue 【get方法声明...2013-04-27 19:22:58 · 81 阅读 · 0 评论 -
hibernate3.6-联合主键注解以及openSession和getCurrentSession区别
【联合主键】>>>>配置方式:xml: 1. Student中单独创建StudentPk主键实体类 2. 配置:<composite-id name="studentPK"> <key-property name="name" column="username" /> <key2013-04-24 23:34:15 · 106 阅读 · 0 评论 -
hibernate--Criteria+Restrictions
List cats = session.createCriteria(Cat.class) .add( Restrictions.like("name", "Iz%") ) .add( Restrictions.gt( "weight", new Float(minWeight) ) ) .addOrder( Order.asc("age") ) ...原创 2012-02-29 15:30:05 · 108 阅读 · 0 评论 -
Hibernate之第4解之-hibernate_集合映射
hibernate的集合映射demo:前提介绍: 书籍Book【id,name,authors】,authors可能有N个,所以这里用set表示; 实体类一个Book;表呢有两个:tbook、tauthors;1:model:package model;import java.util.Set;public class Book { pr...2011-04-27 12:13:59 · 89 阅读 · 0 评论 -
Hibernate之第3解之-hibernate_hibernate_many2one_1
多对一映射简例:1.我使用学生和地址的关系来做示例:student[s_id,s_name,s_addr]address[a_id,city]2.建立数据库表:create table address( a_id int(10) auto_increment primary key, city varchar(16))engine=MyISAM CHARACTE...2011-04-22 14:39:43 · 93 阅读 · 0 评论 -
hibernate、mysql、中文字符问题
中文乱码-- 问号 ??1:我的Eclipse默认字符集已经是UTF8了;2:mysql6的数据库默认字符集也是UTF8;3:建表的语句也表明:ENGINE=MyISAM CHARACTER SET=utf8;4:某一向为人谦和,不张扬,行事低调--人品也是绝对兼容UTF8的!这就怪了,删表重建、drop 数据库重建、停服务重修改my.ini重建--都不能解决问题。NN...2011-04-21 16:53:32 · 120 阅读 · 0 评论 -
Hibernate之第2解之-hibernate_demo_1_annotation
上一个例子是一个基础的HIbernate的CRUD,不过用的是hbm.xml映射持久化类;这里将第一个例子稍作改动,改为annotation的,使用注解可以免去持久化类的配置文件。step1:修改Student持久化类:package model;import javax.persistence.Column;import javax.persistence.Entity;...2011-04-20 17:38:25 · 93 阅读 · 0 评论 -
Hibernate之第1解之-hibernate_demo_1
准备工作做好了,开始Hibernate:1:建立包:package:dao、model、service、util包;2:开始model实体类Student:id,sname生成getter/setter;package model;public class Student { private int id; private String name; public...2011-04-20 15:59:21 · 128 阅读 · 0 评论 -
Hibernate之第〇解之准备工作
从今天开始,小可将自己学习Hibernate的步骤一一登记,以供日后遗忘之需。下面开始准备工作:1.新建java project--hibernate_demo_1;2.新建src folder--testsrc用作JUnit测试;3.hibernate用到的jar包:[版本:hibernate-distribution-3.6.0.CR2-dist.zip]<1>...原创 2011-04-20 11:06:09 · 93 阅读 · 0 评论 -
Q: JPA- MappingException: Could not determine type for:
org.hibernate.MappingException: Could not determine type for: com.niewj.model.Probe, at table: VoipService, for columns: [org.hibernate.mapping.Column(probe)] JPA注解的这个问题,多半是以下问题:注解有的在字段上,有的在ge...2013-06-06 17:12:39 · 184 阅读 · 0 评论