(九)Hibernate 检索策略
所有项目导入对应的hibernate的jar包、mysql的jar包和添加每次都需要用到的HibernateUtil.java
这里的hibernate.cfg.xml配置信息我就不再写了
第一节:检索策略属性Lazy
Lazy:true (默认) 延迟检索;set 端一对多
Lazy:false 立即检索;set 端一对多
Lazy:extra 增强延迟检索; set 端一对多
Lazy:proxy(默认) 延迟检索;many-to-one 多对一
Lazy:no-proxy 无代理延迟检索;many-to-one 多对一(需要编译时字节码增强)
Lazy:true (默认) 延迟检索;set 端一对多
Class.java
package com.wishwzp.model; import java.util.HashSet;
import java.util.Set; public class Class { private long id;
private String name;
private Set<Student> students=new HashSet<Student>(); public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Set<Student> getStudents() {
return students;
}
public void setStudents(Set<Student> students) {
this.students = students;
} }
Student.java
package com.wishwzp.model; public class Student { private long id;
private String name;
private Class c; public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
} public Class getC() {
return c;
}
public void setC(Class c) {
this.c = c;
}
@Override
public String toString() {
return "Student [id=" + id + ", name=" + name + "]";
}
}
Class.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.wishwzp.model"> <class name="Class" table="t_class">
<id name="id" column="classId">
<generator class="native"></generator>
</id> <property name="name" column="className"></property> <set name="students" cascade="delete" inverse="true" lazy="true">
<key column="classId"></key>
<one-to-many class="com.wishwzp.model.Student"/>
</set>
</class> </hibernate-mapping>
Student.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.wishwzp.model"> <class name="Student" table="t_student">
<id name="id" column="stuId">
<generator class="native"></generator>
</id> <property name="name" column="stuName"></property> <many-to-one name="c" column="classId" class="com.wishwzp.model.Class" cascade="save-update"></many-to-one>
</class> </hibernate-mapping>
StudentTest.java
package com.wishwzp.service; import java.util.Iterator;
import java.util.List;
import java.util.Set; import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test; import com.wishwzp.model.Class;
import com.wishwzp.model.Student;
import com.wishwzp.util.HibernateUtil; public class StudentTest { private SessionFactory sessionFactory=HibernateUtil.getSessionFactory();
private Session session; @Before
public void setUp() throws Exception {
session=sessionFactory.openSession(); // 生成一个session
session.beginTransaction(); // 开启事务
} @After
public void tearDown() throws Exception {
session.getTransaction().commit(); // 提交事务
session.close(); // 关闭session
} @Test
public void testLazy1() {
Class c=(Class)session.get(Class.class, Long.valueOf(1));
Set<Student> studentList=(Set<Student>)c.getStudents();
studentList.iterator();
}
}
数据库里面的信息数据:
运行显示结果:
Hibernate: select class0_.classId as classId1_0_0_, class0_.className as classNam2_0_0_ from t_class class0_ where class0_.classId=?
Hibernate: select students0_.classId as classId3_0_0_, students0_.stuId as stuId1_1_0_, students0_.stuId as stuId1_1_1_, students0_.stuName as stuName2_1_1_, students0_.classId as classId3_1_1_ from t_student students0_ where students0_.classId=?
Lazy:false 立即检索;set 端一对多
Class.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.wishwzp.model"> <class name="Class" table="t_class">
<id name="id" column="classId">
<generator class="native"></generator>
</id> <property name="name" column="className"></property> <set name="students" cascade="delete" inverse="true" lazy="false">
<key column="classId"></key>
<one-to-many class="com.wishwzp.model.Student"/>
</set>
</class> </hibernate-mapping>
StudentTest.java
package com.wishwzp.service; import java.util.Iterator;
import java.util.List;
import java.util.Set; import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test; import com.wishwzp.model.Class;
import com.wishwzp.model.Student;
import com.wishwzp.util.HibernateUtil; public class StudentTest { private SessionFactory sessionFactory=HibernateUtil.getSessionFactory();
private Session session; @Before
public void setUp() throws Exception {
session=sessionFactory.openSession(); // 生成一个session
session.beginTransaction(); // 开启事务
} @After
public void tearDown() throws Exception {
session.getTransaction().commit(); // 提交事务
session.close(); // 关闭session
} @Test
public void testLazy1() {
Class c=(Class)session.get(Class.class, Long.valueOf(1)); } }
还是上面第一个的数据库信息。
运行显示结果:
Hibernate: select class0_.classId as classId1_0_0_, class0_.className as classNam2_0_0_ from t_class class0_ where class0_.classId=?
Hibernate: select students0_.classId as classId3_0_0_, students0_.stuId as stuId1_1_0_, students0_.stuId as stuId1_1_1_, students0_.stuName as stuName2_1_1_, students0_.classId as classId3_1_1_ from t_student students0_ where students0_.classId=?
Lazy:extra 增强延迟检索; set 端一对多
Class.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.wishwzp.model"> <class name="Class" table="t_class">
<id name="id" column="classId">
<generator class="native"></generator>
</id> <property name="name" column="className"></property> <set name="students" cascade="delete" inverse="true" lazy="extra">
<key column="classId"></key>
<one-to-many class="com.wishwzp.model.Student"/>
</set>
</class> </hibernate-mapping>
StudentTest.java
package com.wishwzp.service; import java.util.Iterator;
import java.util.List;
import java.util.Set; import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test; import com.wishwzp.model.Class;
import com.wishwzp.model.Student;
import com.wishwzp.util.HibernateUtil; public class StudentTest { private SessionFactory sessionFactory=HibernateUtil.getSessionFactory();
private Session session; @Before
public void setUp() throws Exception {
session=sessionFactory.openSession(); // 生成一个session
session.beginTransaction(); // 开启事务
} @After
public void tearDown() throws Exception {
session.getTransaction().commit(); // 提交事务
session.close(); // 关闭session
} @Test
public void testLazy1() {
Class c=(Class)session.get(Class.class, Long.valueOf(1));
Set<Student> studentList=(Set<Student>)c.getStudents();
System.out.println(studentList.size());
} }
还是上面第一个的数据库信息。
运行结果显示:
Hibernate: select class0_.classId as classId1_0_0_, class0_.className as classNam2_0_0_ from t_class class0_ where class0_.classId=?
Hibernate: select count(stuId) from t_student where classId =?
3
Lazy:proxy(默认) 延迟检索;many-to-one 多对一
Student.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.wishwzp.model"> <class name="Student" table="t_student">
<id name="id" column="stuId">
<generator class="native"></generator>
</id> <property name="name" column="stuName"></property> <many-to-one name="c" column="classId" class="com.wishwzp.model.Class" cascade="save-update" lazy="proxy"></many-to-one>
</class> </hibernate-mapping>
StudentTest.java
package com.wishwzp.service; import java.util.Iterator;
import java.util.List;
import java.util.Set; import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test; import com.wishwzp.model.Class;
import com.wishwzp.model.Student;
import com.wishwzp.util.HibernateUtil; public class StudentTest { private SessionFactory sessionFactory=HibernateUtil.getSessionFactory();
private Session session; @Before
public void setUp() throws Exception {
session=sessionFactory.openSession(); // 生成一个session
session.beginTransaction(); // 开启事务
} @After
public void tearDown() throws Exception {
session.getTransaction().commit(); // 提交事务
session.close(); // 关闭session
} @Test
public void testLazy2() {
Student student=(Student)session.get(Student.class, Long.valueOf(1));
student.getC().getName();
} }
运行显示结果:
Hibernate: select student0_.stuId as stuId1_1_0_, student0_.stuName as stuName2_1_0_, student0_.classId as classId3_1_0_ from t_student student0_ where student0_.stuId=?
Hibernate: select class0_.classId as classId1_0_0_, class0_.className as classNam2_0_0_ from t_class class0_ where class0_.classId=?
Lazy:no-proxy 无代理延迟检索;many-to-one 多对一(需要编译时字节码增强)
Student.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.wishwzp.model"> <class name="Student" table="t_student">
<id name="id" column="stuId">
<generator class="native"></generator>
</id> <property name="name" column="stuName"></property> <many-to-one name="c" column="classId" class="com.wishwzp.model.Class" cascade="save-update" lazy="no-proxy"></many-to-one>
</class> </hibernate-mapping>
StudentTest.java和上面一样
第二节:检索策略属性batch-size
1,批量延迟检索;
2,批量立即检索;
1,批量延迟检索;
Class.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.wishwzp.model"> <class name="Class" table="t_class">
<id name="id" column="classId">
<generator class="native"></generator>
</id> <property name="name" column="className"></property> <set name="students" cascade="delete" inverse="true" lazy="true" batch-size="3">
<key column="classId"></key>
<one-to-many class="com.wishwzp.model.Student"/>
</set>
</class> </hibernate-mapping>
StudentTest.java
package com.wishwzp.service; import java.util.Iterator;
import java.util.List;
import java.util.Set; import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test; import com.wishwzp.model.Class;
import com.wishwzp.model.Student;
import com.wishwzp.util.HibernateUtil; public class StudentTest { private SessionFactory sessionFactory=HibernateUtil.getSessionFactory();
private Session session; @Before
public void setUp() throws Exception {
session=sessionFactory.openSession(); // 生成一个session
session.beginTransaction(); // 开启事务
} @After
public void tearDown() throws Exception {
session.getTransaction().commit(); // 提交事务
session.close(); // 关闭session
} @Test
public void testBatch1(){
List<Class> classList=session.createQuery("from Class").list();
Iterator it=classList.iterator();
Class c1=(Class)it.next();
Class c2=(Class)it.next();
Class c3=(Class)it.next();
c1.getStudents().iterator();
c2.getStudents().iterator();
c3.getStudents().iterator();
} }
数据库多加了一条信息:
运行结果显示:
Hibernate: select class0_.classId as classId1_0_, class0_.className as classNam2_0_ from t_class class0_
Hibernate: select students0_.classId as classId3_0_1_, students0_.stuId as stuId1_1_1_, students0_.stuId as stuId1_1_0_, students0_.stuName as stuName2_1_0_, students0_.classId as classId3_1_0_ from t_student students0_ where students0_.classId in (?, ?, ?)
2,批量立即检索;
Class.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.wishwzp.model"> <class name="Class" table="t_class">
<id name="id" column="classId">
<generator class="native"></generator>
</id> <property name="name" column="className"></property> <set name="students" cascade="delete" inverse="true" lazy="false" batch-size="3">
<key column="classId"></key>
<one-to-many class="com.wishwzp.model.Student"/>
</set>
</class> </hibernate-mapping>
StudentTest.java
package com.wishwzp.service; import java.util.Iterator;
import java.util.List;
import java.util.Set; import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test; import com.wishwzp.model.Class;
import com.wishwzp.model.Student;
import com.wishwzp.util.HibernateUtil; public class StudentTest { private SessionFactory sessionFactory=HibernateUtil.getSessionFactory();
private Session session; @Before
public void setUp() throws Exception {
session=sessionFactory.openSession(); // 生成一个session
session.beginTransaction(); // 开启事务
} @After
public void tearDown() throws Exception {
session.getTransaction().commit(); // 提交事务
session.close(); // 关闭session
} @Test
public void testBatch2(){
List<Class> classList=session.createQuery("from Class").list(); } }
运行结果显示:
Hibernate: select class0_.classId as classId1_0_, class0_.className as classNam2_0_ from t_class class0_
Hibernate: select students0_.classId as classId3_0_1_, students0_.stuId as stuId1_1_1_, students0_.stuId as stuId1_1_0_, students0_.stuName as stuName2_1_0_, students0_.classId as classId3_1_0_ from t_student students0_ where students0_.classId in (?, ?, ?)
假如我们将Class.hbm.xml的batch-size="3"改成batch-size="2"的话,运行结果显示:
Hibernate: select class0_.classId as classId1_0_, class0_.className as classNam2_0_ from t_class class0_
Hibernate: select students0_.classId as classId3_0_1_, students0_.stuId as stuId1_1_1_, students0_.stuId as stuId1_1_0_, students0_.stuName as stuName2_1_0_, students0_.classId as classId3_1_0_ from t_student students0_ where students0_.classId in (?, ?)
Hibernate: select students0_.classId as classId3_0_1_, students0_.stuId as stuId1_1_1_, students0_.stuId as stuId1_1_0_, students0_.stuName as stuName2_1_0_, students0_.classId as classId3_1_0_ from t_student students0_ where students0_.classId=?
第三节:检索策略属性Fetch
1,Fetch:select(默认) 查询方式;
2,Fetch:subselect 子查询方式;
3,Fetch:join 迫切左外连接查询方式;
1,Fetch:select(默认) 查询方式;
Class.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.wishwzp.model"> <class name="Class" table="t_class">
<id name="id" column="classId">
<generator class="native"></generator>
</id> <property name="name" column="className"></property> <set name="students" cascade="delete" inverse="true" lazy="false" batch-size="2" fetch="select">
<key column="classId"></key>
<one-to-many class="com.wishwzp.model.Student"/>
</set>
</class> </hibernate-mapping>
StudentTest.java
package com.wishwzp.service; import java.util.Iterator;
import java.util.List;
import java.util.Set; import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test; import com.wishwzp.model.Class;
import com.wishwzp.model.Student;
import com.wishwzp.util.HibernateUtil; public class StudentTest { private SessionFactory sessionFactory=HibernateUtil.getSessionFactory();
private Session session; @Before
public void setUp() throws Exception {
session=sessionFactory.openSession(); // 生成一个session
session.beginTransaction(); // 开启事务
} @After
public void tearDown() throws Exception {
session.getTransaction().commit(); // 提交事务
session.close(); // 关闭session
} @Test
public void testFetch1(){
List<Class> classList=session.createQuery("from Class").list();
Iterator it=classList.iterator();
Class c1=(Class)it.next();
Class c2=(Class)it.next();
Class c3=(Class)it.next();
c1.getStudents().iterator();
c2.getStudents().iterator();
c3.getStudents().iterator();
} }
运行结果显示:
Hibernate: select class0_.classId as classId1_0_, class0_.className as classNam2_0_ from t_class class0_
Hibernate: select students0_.classId as classId3_0_1_, students0_.stuId as stuId1_1_1_, students0_.stuId as stuId1_1_0_, students0_.stuName as stuName2_1_0_, students0_.classId as classId3_1_0_ from t_student students0_ where students0_.classId in (?, ?)
Hibernate: select students0_.classId as classId3_0_1_, students0_.stuId as stuId1_1_1_, students0_.stuId as stuId1_1_0_, students0_.stuName as stuName2_1_0_, students0_.classId as classId3_1_0_ from t_student students0_ where students0_.classId=?
2,Fetch:subselect 子查询方式;
Class.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.wishwzp.model"> <class name="Class" table="t_class">
<id name="id" column="classId">
<generator class="native"></generator>
</id> <property name="name" column="className"></property> <set name="students" cascade="delete" inverse="true" lazy="false" batch-size="2" fetch="subselect">
<key column="classId"></key>
<one-to-many class="com.wishwzp.model.Student"/>
</set>
</class> </hibernate-mapping>
StudentTest.java
package com.wishwzp.service; import java.util.Iterator;
import java.util.List;
import java.util.Set; import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test; import com.wishwzp.model.Class;
import com.wishwzp.model.Student;
import com.wishwzp.util.HibernateUtil; public class StudentTest { private SessionFactory sessionFactory=HibernateUtil.getSessionFactory();
private Session session; @Before
public void setUp() throws Exception {
session=sessionFactory.openSession(); // 生成一个session
session.beginTransaction(); // 开启事务
} @After
public void tearDown() throws Exception {
session.getTransaction().commit(); // 提交事务
session.close(); // 关闭session
} @Test
public void testFetch1(){
List<Class> classList=session.createQuery("from Class").list();
Iterator it=classList.iterator();
Class c1=(Class)it.next();
Class c2=(Class)it.next();
Class c3=(Class)it.next();
c1.getStudents().iterator();
c2.getStudents().iterator();
c3.getStudents().iterator();
} }
运行结果显示:
Hibernate: select class0_.classId as classId1_0_, class0_.className as classNam2_0_ from t_class class0_
Hibernate: select students0_.classId as classId3_0_1_, students0_.stuId as stuId1_1_1_, students0_.stuId as stuId1_1_0_, students0_.stuName as stuName2_1_0_, students0_.classId as classId3_1_0_ from t_student students0_ where students0_.classId in (select class0_.classId from t_class class0_)
3,Fetch:join 迫切左外连接查询方式;
Class.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.wishwzp.model"> <class name="Class" table="t_class">
<id name="id" column="classId">
<generator class="native"></generator>
</id> <property name="name" column="className"></property> <set name="students" cascade="delete" inverse="true" lazy="false" batch-size="2" fetch="join">
<key column="classId"></key>
<one-to-many class="com.wishwzp.model.Student"/>
</set>
</class> </hibernate-mapping>
StudentTest.java
package com.wishwzp.service; import java.util.Iterator;
import java.util.List;
import java.util.Set; import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test; import com.wishwzp.model.Class;
import com.wishwzp.model.Student;
import com.wishwzp.util.HibernateUtil; public class StudentTest { private SessionFactory sessionFactory=HibernateUtil.getSessionFactory();
private Session session; @Before
public void setUp() throws Exception {
session=sessionFactory.openSession(); // 生成一个session
session.beginTransaction(); // 开启事务
} @After
public void tearDown() throws Exception {
session.getTransaction().commit(); // 提交事务
session.close(); // 关闭session
} @Test
public void testFetch2(){
Class c=(Class)session.get(Class.class, Long.valueOf(1));
}
}
运行结果显示:
Hibernate: select class0_.classId as classId1_0_0_, class0_.className as classNam2_0_0_, students1_.classId as classId3_0_1_, students1_.stuId as stuId1_1_1_, students1_.stuId as stuId1_1_2_, students1_.stuName as stuName2_1_2_, students1_.classId as classId3_1_2_ from t_class class0_ left outer join t_student students1_ on class0_.classId=students1_.classId where class0_.classId=?
END
(九)Hibernate 检索策略的更多相关文章
- Hibernate —— 检索策略
一.Hibernate 的检索策略本质上是为了优化 Hibernate 性能. 二.Hibernate 检索策略包括类级别的检索策略.和关联级别的检索策略(<set> 元素) 三.类级别的 ...
- hibernate(八) Hibernate检索策略(类级别,关联级别,批量检索)详解
序言 很多看起来很难的东西其实并不难,关键是看自己是否花费了时间和精力去看,如果一个东西你能看得懂,同样的,别人也能看得懂,体现不出和别人的差距,所以当你觉得自己看了很多书或者学了很多东西的时候,你要 ...
- Hibernate 检索策略
概述 检索数据时的 2 个问题: –不浪费内存:当 Hibernate 从数据库中加载 Customer 对象时, 如果同时加载所有关联的 Order 对象, 而程序实际上仅仅需要访问 Custome ...
- Hibernate检索策略(抓取策略)(Hibernate检索优化)
一.查询方法中get方法采用策略是立即检索,而load方法采用策略是延迟检索,延迟检索是在使用数据时才发送SQL语句加载数据 获取延迟加载数据方式:1.使用的时候,如果Customer c=sessi ...
- [原创]java WEB学习笔记88:Hibernate学习之路-- -Hibernate检索策略(立即检索,延迟检索,迫切左外连接检索)
本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...
- Hibernate检索策略
1. Hibernate的检索策略概述: 检索数据时的 2 个问题: 1.不浪费内存:当 Hibernate 从数据库中加载 Customer 对象时, 如果同时加载所有关联的 Order 对象 ...
- Hibernate学习(八)———— Hibernate检索策略(类级别,关联级别,批量检索)详解
序言 很多看起来很难的东西其实并不难,关键是看自己是否花费了时间和精力去看,如果一个东西你能看得懂,同样的,别人也能看得懂,体现不出和别人的差距,所以当你觉得自己看了很多书或者学了很多东西的时候,你要 ...
- hibernate检索策略(抓取策略)
检索策略 类级别检索 默认检索策略:默认延迟加载, 可以使用lazy属性来进行改变. session.get(clazz,object)默认立即加载 @Test //测试左外连接查询 public v ...
- Hibernate检索策略与检索方式
hibernate的Session在加载Java对象时,一般都会把鱼这个对象相关联的其他Java对象也都加载到缓存中,以方便程序的调用.但很多情况下,我们不需要加载太多无用的对象到缓存中,一来会占用大 ...
随机推荐
- ASP.NET SignalR2持久连接层解析
越是到年底越是感觉浑身无力,看着啥也不想动,只期盼着年终奖的到来以此来给自己打一针强心剂.估摸着大多数人都跟我一样犯着这样浑身无力的病,感觉今年算是没挣到啥钱,但是话也不能这么说,搞得好像去年挣到钱了 ...
- [iOS基础控件 - 4.4] 进一步封装"APP列表”,初见MVC模式
A.从ViewController分离View 之前的代码中,View的数据加载逻辑放在了总的ViewController中,增加了耦合性,应该对控制器ViewController隐藏数据加载到Vie ...
- Android 解析 xml
URL httpUrl = new URL(url); HttpURLConnection conn = (HttpURLConnection )httpUrl.openConnection(); c ...
- sonne_game网站开发03 spring-mvc+freemarker整合
今天的任务就是在spring+mybatis+springmvc的基础上,将freemarker整合进来. freemarker是什么? freemarker是一种模板引擎.它的目的是基于模板和数据, ...
- Stage3D学习笔记(一):3D术语简介
网格(Mesh) 3D中,所有可见的模型都被称作网格.网格是由3DMax等建模软件制作,定义了一个3D物体的形状.一个网格是由多个多边形组成的. 多边形(Polygon) 一个多边形是组成网格的一个最 ...
- Linux基本操作 9----- 认识与学习bash
一 认识bash这个shell 1 管理整个计算机硬件的其实就是操作系统的内核,这个内核是需要被保护的,所以我们一般用户就只能通过shell来跟内核通信,以让内核达到我们所想打到的工作. 2 只要能够 ...
- 【转】移动前端手机输入法自带emoji表情字符处理
http://blog.csdn.net/binjly/article/details/47321043 今天,测试给我提了一个BUG,说移动端输入emoji表情无法提交.很早以前就有思考过,手机输入 ...
- 有关AES加密的问题
遇到一个项目,需要用AES加密密码,android的已经写好了,java源码: private static final String AES_OPTIONS = "AES/ECB/PKCS ...
- DSC配置
#配置Remote Desktop Services服务为 自启动,并运行 Configuration Myservice{ # A Configuration block can have zero ...
- Jenkins(二)
官网:https://wiki.jenkins-ci.org/display/JENKINS/Meet+Jenkins 我的这篇文章不过简单的依据上文,介绍Jenkins提供了哪些功能.详细大家还是要 ...