该文被密码保护。 阅读全文
摘要:
OSCache可以支持中央缓存要想支持缓存hibernate.cfg.xml应该做如下配置:<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hiberna 阅读全文
摘要:
1、Hibernate对于集合不区分空集和null,也就是说下面这两种情况在Hibernate里面是一样的:Collection c = new ArrayList();//c != nullCollection c1 = null; 阅读全文
摘要:
类与表的关系:*************Employee.java*************package blog.hibernate.domain; public class Employee { private int id; private String name; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { re... 阅读全文
摘要:
类和表的关系:单独使用<subclass/>元素的类会和父类在同一张表里;使用<subclass><join></join></subclass>这两个元素的类会单独占一个表。*************Employee.java*************package blog.hibernate.domain; public class Employee { private int id; private String name; public int getId() { return id; } public void setI. 阅读全文
摘要:
类与表的关系:*************Employee.java*************package blog.hibernate.domain; public class Employee { private int id; private String name; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { re... 阅读全文
摘要:
类与表的关系:*************Employee.java*************package blog.hibernate.domain; public class Employee { private int id; private String name; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { re... 阅读全文
摘要:
***************Student.java***************package blog.hibernate.domain; import java.util.ArrayList;
import java.util.List; public class Student { private int id; private String name; private List<Teacher> teachers = new ArrayList<Teacher>(); public List<Teacher> getTeachers() {
.. 阅读全文
摘要:
****************hibernate.cfg.xml***************<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hiber 阅读全文
摘要:
***************Teacher.java***************package blog.hibernate.domain; import java.util.HashMap;
import java.util.List;
import java.util.Map; public class Teacher { private int id; private String name; private String course; private Map<String, Student> students = new HashMap<S... 阅读全文