`
zy77612
  • 浏览: 283998 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

HiberNate学习-3 映射关系

 
阅读更多

1 Hibernate的一对多关联映射

核心代码:

Xml代码 复制代码 收藏代码
  1. <setname="students">
  2. <keycolumn="classesId"/>
  3. <one-to-manyclass="Students"/>
  4. </set>
<set name="students">
	<key column="classesId"/>
	<one-to-many class="Students"/>
</set>

 

hihernate一对多关联映射(单向Classes----->Student)

一对多关联映射利用了多对一关联映射原理

多对一关联映射:在多的一端加入一个外键指向一的一端,它维护的关系是多指向一
一对多关联映射:在多的一端加入一个外键指向一的一端,它维护的关系是一指向多

也就是说一对多和多对一的映射策略是一样的,只是站的角度不同

在一端维护关系的缺点:
* 如果将t_student表里的classesid字段设置为非空,则无法保存
* 因为不是在student这一端维护关系,所以student不知道是哪个班的,
所以需要发出多余的update语句来更新关系

 

一:实体类:

Classes.java代码 复制代码 收藏代码
  1. package com.tao.hibernate.one2many;
  2. import java.util.Set;
  3. public class Classes {
  4. private Integer id;
  5. private String name;
  6. private Set<Students> students;
  7. public Classes() {
  8. super();
  9. }
  10. public Integer getId() {
  11. return id;
  12. }
  13. public void setId(Integer id) {
  14. this.id = id;
  15. }
  16. public String getName() {
  17. return name;
  18. }
  19. public void setName(String name) {
  20. this.name = name;
  21. }
  22. public Set<Students> getStudents() {
  23. return students;
  24. }
  25. public void setStudents(Set<Students> students) {
  26. this.students = students;
  27. }
  28. }
package com.tao.hibernate.one2many;

import java.util.Set;

public class Classes {
	private Integer id;
	private String name;
	private Set<Students> students;

	public Classes() {
		super();
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Set<Students> getStudents() {
		return students;
	}

	public void setStudents(Set<Students> students) {
		this.students = students;
	}

}
Students.java代码 复制代码 收藏代码
  1. package com.tao.hibernate.one2many;
  2. public class Students {
  3. private Integer id;
  4. private String name;
  5. private Classes classes;
  6. public Students() {
  7. super();
  8. }
  9. public Integer getId() {
  10. return id;
  11. }
  12. public void setId(Integer id) {
  13. this.id = id;
  14. }
  15. public String getName() {
  16. return name;
  17. }
  18. public void setName(String name) {
  19. this.name = name;
  20. }
  21. public Classes getClasses() {
  22. return classes;
  23. }
  24. public void setClasses(Classes classes) {
  25. this.classes = classes;
  26. }
  27. }
package com.tao.hibernate.one2many;

public class Students {
	private Integer id;
	private String name;
	private Classes classes;

	public Students() {
		super();
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Classes getClasses() {
		return classes;
	}

	public void setClasses(Classes classes) {
		this.classes = classes;
	}

}

二:映射文件:

Classes.hbm.xml代码 复制代码 收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  3. "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
  4. <hibernate-mapping package="com.tao.hibernate.one2many">
  5. <class name="Classes" table="t_classes">
  6. <id name="id" column="id" type="integer">
  7. <generator class="native" />
  8. </id>
  9. <property name="name" column="name" />
  10. <set name="students">
  11. <key column="classId"/>
  12. <one-to-many class="Students"/>
  13. </set>
  14. </class>
  15. </hibernate-mapping>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.tao.hibernate.one2many">
	<class name="Classes" table="t_classes">
		<id name="id" column="id" type="integer">
			<generator class="native" />
		</id>
		<property name="name" column="name" />
		<set name="students">
			<key column="classId"/>
			<one-to-many class="Students"/>
		</set>
	</class>
</hibernate-mapping>

 

Students.hbm.xml代码 复制代码 收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  3. "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
  4. <hibernate-mapping package="com.tao.hibernate.one2many">
  5. <class name="Students" table="t_students">
  6. <id name="id" column="id" type="integer">
  7. <generator class="native" />
  8. </id>
  9. <property name="name" column="name" />
  10. </class>
  11. </hibernate-mapping>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.tao.hibernate.one2many">
	<class name="Students" table="t_students">
		<id name="id" column="id" type="integer">
			<generator class="native" />
		</id>
		<property name="name" column="name" />
	</class>
</hibernate-mapping>

三:测试类:

Testmain.java代码 复制代码 收藏代码
  1. package com.tao.hibernate.one2many;
  2. import java.util.HashSet;
  3. import java.util.Iterator;
  4. import java.util.Set;
  5. import org.hibernate.Session;
  6. import org.hibernate.Transaction;
  7. import org.junit.Test;
  8. import com.tao.hibernate.HibernateUtils;
  9. public class TestMain {
  10. Session session = HibernateUtils.getFactory().openSession();
  11. @Test
  12. public void testSave() {
  13. Students s1 = new Students();
  14. s1.setName("tao");
  15. Students s2 = new Students();
  16. s2.setName("war");
  17. Classes c = new Classes();
  18. c.setName("148班");
  19. Set<Students> students = new HashSet<Students>();
  20. students.add(s1);
  21. students.add(s2);
  22. c.setStudents(students);
  23. Transaction ts = session.beginTransaction();
  24. ts.begin();
  25. session.save(s1);
  26. session.save(s2);
  27. session.save(c);
  28. ts.commit();
  29. }
  30. @Test
  31. public void testLoad() {
  32. Session session = HibernateUtils.getFactory().openSession();
  33. Classes c = (Classes) session.load(Classes.class, 1);
  34. for (Iterator<Students> iter = c.getStudents().iterator(); iter
  35. .hasNext();) {
  36. System.out.println(iter.next().getName());
  37. }
  38. }
  39. }

2 Hibernate的一对多和多对一双向关联映射

核心代码:

<many-to-one name="classes" column="classesId"/>

<set name="students" inverse="true" cascade="all">
<key column="classesId" />
<one-to-many class="Students" />
</set>

 

hihernate一对多关联映射(双向Classes<----->Student)

一对多双向关联映射:
* 在一一端的集合上使用<key>,在对方表中加入一个外键指向一一端
* 在多一端采用<many-to-one>

注意:<key>标签指定的外键字段必须和<many-to-one>指定的外键字段一致,否则引用字段的错误

如果在”一“一端维护一对多关联关系,hibernate会发出多余的udpate语句,所以我们一般在多
的一端来维护关联关系

关于inverse属性:
inverse主要用在一对多和多对多双向关联上,inverse可以被设置到集合标签<set>上,
默认inverse为false,所以我们可以从”一“一端和”多“一端维护关联关系,
如果设置成inverse为true,则我们只能从多一端来维护关联关系

注意:inverse属性,只影响数据的存储,也就是持久化

inverse和cascade
* inverse是关联关系的控制方向
* cascade操作上的连锁反应

 

一:实体类:

Classes.java代码 复制代码 收藏代码
  1. package com.tao.hibernate.one2many2;
  2. import java.util.Set;
  3. public class Classes {
  4. private Integer id;
  5. private String name;
  6. private Set<Students> students;
  7. public Classes() {
  8. super();
  9. }
  10. public Integer getId() {
  11. return id;
  12. }
  13. public void setId(Integer id) {
  14. this.id = id;
  15. }
  16. public String getName() {
  17. return name;
  18. }
  19. public void setName(String name) {
  20. this.name = name;
  21. }
  22. public Set<Students> getStudents() {
  23. return students;
  24. }
  25. public void setStudents(Set<Students> students) {
  26. this.students = students;
  27. }
  28. }
package com.tao.hibernate.one2many2;

import java.util.Set;

public class Classes {
	private Integer id;
	private String name;
	private Set<Students> students;

	public Classes() {
		super();
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Set<Students> getStudents() {
		return students;
	}

	public void setStudents(Set<Students> students) {
		this.students = students;
	}

}

 

Students.java代码 复制代码 收藏代码
  1. package com.tao.hibernate.one2many2;
  2. public class Students {
  3. private Integer id;
  4. private String name;
  5. private Classes classes;
  6. public Students() {
  7. super();
  8. }
  9. public Integer getId() {
  10. return id;
  11. }
  12. public void setId(Integer id) {
  13. this.id = id;
  14. }
  15. public String getName() {
  16. return name;
  17. }
  18. public void setName(String name) {
  19. this.name = name;
  20. }
  21. public Classes getClasses() {
  22. return classes;
  23. }
  24. public void setClasses(Classes classes) {
  25. this.classes = classes;
  26. }
  27. }
package com.tao.hibernate.one2many2;

public class Students {
	private Integer id;
	private String name;
	private Classes classes;

	public Students() {
		super();
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Classes getClasses() {
		return classes;
	}

	public void setClasses(Classes classes) {
		this.classes = classes;
	}

}

 

二:映射文件:

Classes.hbm.xml代码 复制代码 收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  3. "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
  4. <hibernate-mapping package="com.tao.hibernate.one2many2" auto-import="false">
  5. <class name="Classes" table="t_classes">
  6. <id name="id" column="id" type="integer">
  7. <generator class="native" />
  8. </id>
  9. <property name="name" column="name" />
  10. <set name="students" inverse="true" cascade="all">
  11. <key column="classesId" />
  12. <one-to-many class="Students" />
  13. </set>
  14. </class>
  15. </hibernate-mapping>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.tao.hibernate.one2many2" auto-import="false">
	<class name="Classes" table="t_classes">
		<id name="id" column="id" type="integer">
			<generator class="native" />
		</id>
		<property name="name" column="name" />
		<set name="students" inverse="true" cascade="all">
			<key column="classesId" />
			<one-to-many class="Students" />
		</set>
	</class>
</hibernate-mapping>

 

Students.hbm.xml代码 复制代码 收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  3. "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
  4. <hibernate-mapping package="com.tao.hibernate.one2many2" auto-import="false">
  5. <class name="Students" table="t_students">
  6. <id name="id" column="id" type="integer">
  7. <generator class="native" />
  8. </id>
  9. <property name="name" column="name" />
  10. <many-to-one name="classes" column="classesId"/>
  11. </class>
  12. </hibernate-mapping>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.tao.hibernate.one2many2" auto-import="false">
	<class name="Students" table="t_students">
		<id name="id" column="id" type="integer">
			<generator class="native" />
		</id>
		<property name="name" column="name" />
		<many-to-one name="classes" column="classesId"/>
	</class>
</hibernate-mapping>

 

三:测试类:

Testmain.java代码 复制代码 收藏代码
  1. package com.tao.hibernate.one2many2;
  2. import java.util.HashSet;
  3. import java.util.Iterator;
  4. import java.util.Set;
  5. import org.hibernate.Session;
  6. import org.hibernate.Transaction;
  7. import org.junit.Test;
  8. import com.tao.hibernate.HibernateUtils;
  9. public class TestMain {
  10. Session session = HibernateUtils.getFactory().openSession();
  11. @Test
  12. public void testSave() {
  13. Students s1 = new Students();
  14. s1.setName("tao");
  15. Students s2 = new Students();
  16. s2.setName("war");
  17. Classes c = new Classes();
  18. c.setName("148班");
  19. Set<Students> students = new HashSet<Students>();
  20. students.add(s1);
  21. students.add(s2);
  22. c.setStudents(students);
  23. s1.setClasses(c);
  24. s2.setClasses(c);
  25. Transaction ts = session.beginTransaction();
  26. ts.begin();
  27. session.save(c);
  28. ts.commit();
  29. }
  30. @Test
  31. public void testLoad() {
  32. Session session = HibernateUtils.getFactory().openSession();
  33. Classes c = (Classes) session.load(Classes.class, 1);
  34. for (Iterator<Students> iter = c.getStudents().iterator(); iter
  35. .hasNext();) {
  36. System.out.println(iter.next().getName());
  37. }
  38. }
  39. @Test
  40. public void testLoad2() {
  41. Session session = HibernateUtils.getFactory().openSession();
  42. Students s = (Students) session.load(Students.class, 1);
  43. System.out.println(s.getName());
  44. System.out.println(s.getClasses().getName());
  45. }
  46. }

3.Hibernate的多对多单向关联映射  

 

 

hibernate多对多关联映射(单向User---->Role)

具体映射方式:
<set name="roles" table="t_user_role">
<key column="userid"/>
<many-to-many class="Role" column="roleid"/>
</set>

 

一:实体类:

Role.java代码 复制代码 收藏代码
  1. package com.tao.hibernate.many2many;
  2. public class Role {
  3. private Integer id;
  4. private String name;
  5. public Role() {
  6. super();
  7. }
  8. public Integer getId() {
  9. return id;
  10. }
  11. public void setId(Integer id) {
  12. this.id = id;
  13. }
  14. public String getName() {
  15. return name;
  16. }
  17. public void setName(String name) {
  18. this.name = name;
  19. }
  20. }
package com.tao.hibernate.many2many;

public class Role {
	private Integer id;
	private String name;

	public Role() {
		super();
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}

 

User.java代码 复制代码 收藏代码
  1. package com.tao.hibernate.many2many;
  2. import java.util.Set;
  3. public class User {
  4. private Integer id;
  5. private String name;
  6. private Set<Role> roles;
  7. public User() {
  8. super();
  9. }
  10. public Integer getId() {
  11. return id;
  12. }
  13. public void setId(Integer id) {
  14. this.id = id;
  15. }
  16. public String getName() {
  17. return name;
  18. }
  19. public void setName(String name) {
  20. this.name = name;
  21. }
  22. public Set<Role> getRoles() {
  23. return roles;
  24. }
  25. public void setRoles(Set<Role> roles) {
  26. this.roles = roles;
  27. }
  28. }
package com.tao.hibernate.many2many;

import java.util.Set;

public class User {
	private Integer id;
	private String name;
	private Set<Role> roles;

	public User() {
		super();
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Set<Role> getRoles() {
		return roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}
}

 

二:映射文件:

Role.hbm.xml代码 复制代码 收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  3. "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
  4. <hibernate-mapping package="com.tao.hibernate.many2many">
  5. <class name="Role" table="t_role">
  6. <id name="id" column="id" type="integer">
  7. <generator class="native">
  8. </generator>
  9. </id>
  10. <property name="name" column="name" />
  11. </class>
  12. </hibernate-mapping>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.tao.hibernate.many2many">
	<class name="Role" table="t_role">
		<id name="id" column="id" type="integer">
			<generator class="native">
			</generator>
		</id>
		<property name="name" column="name" />
		
	</class>
</hibernate-mapping>

 

User.hbm.xml代码 复制代码 收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  3. "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
  4. <hibernate-mapping package="com.tao.hibernate.many2many"
  5. auto-import="false">
  6. <class name="User" table="t_user">
  7. <id name="id" column="id" type="integer">
  8. <generator class="native">
  9. </generator>
  10. </id>
  11. <property name="name" column="name" />
  12. <set name="roles" table="t_user_role" cascade="all">
  13. <key column="userId" />
  14. <many-to-many class="Role" column="roleId" />
  15. </set>
  16. </class>
  17. </hibernate-mapping>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.tao.hibernate.many2many"
	auto-import="false">
	<class name="User" table="t_user">
		<id name="id" column="id" type="integer">
			<generator class="native">
			</generator>
		</id>
		<property name="name" column="name" />
		<set name="roles" table="t_user_role" cascade="all">
			<key column="userId" />
			<many-to-many class="Role" column="roleId" />
		</set>
	</class>
</hibernate-mapping>

 

三:测试类:

Testmain.java代码 复制代码 收藏代码
  1. package com.tao.hibernate.many2many;
  2. import java.util.HashSet;
  3. import java.util.Iterator;
  4. import java.util.Set;
  5. import org.hibernate.Session;
  6. import org.hibernate.Transaction;
  7. import org.junit.Test;
  8. import com.tao.hibernate.HibernateUtils;
  9. public class TestMain {
  10. Session session = HibernateUtils.getFactory().openSession();
  11. @Test
  12. public void testSave() {
  13. User u1 = new User();
  14. u1.setName("u1");
  15. User u2 = new User();
  16. u2.setName("u2");
  17. User u3 = new User();
  18. u3.setName("u3");
  19. Role r1 = new Role();
  20. r1.setName("admin");
  21. Role r2 = new Role();
  22. r2.setName("guest");
  23. Set<Role> roles1 = new HashSet<Role>();
  24. roles1.add(r1);
  25. Set<Role> roles2 = new HashSet<Role>();
  26. roles2.add(r2);
  27. Set<Role> roles3 = new HashSet<Role>();
  28. roles3.add(r1);
  29. roles3.add(r2);
  30. u1.setRoles(roles1);
  31. u2.setRoles(roles2);
  32. u3.setRoles(roles3);
  33. Transaction ts = session.beginTransaction();
  34. ts.begin();
  35. session.save(u1);
  36. session.save(u2);
  37. session.save(u3);
  38. ts.commit();
  39. }
  40. @Test
  41. public void testLoad() {
  42. Session session = HibernateUtils.getFactory().openSession();
  43. User u1 = (User) session.load(User.class, 1);
  44. System.out.println(u1.getName());
  45. for (Iterator<Role> iter = u1.getRoles().iterator(); iter.hasNext();) {
  46. System.out.println(iter.next().getName());
  47. }
  48. }
  49. }
分享到:
评论

相关推荐

    hibernate-release-5.2.10

    Hibernate是Java平台上的一款开源对象关系映射(ORM)框架,它允许开发者用面向对象的方式处理数据库操作。在SSH(Spring、Struts、Hibernate)框架中,Hibernate作为持久层的解决方案,极大地简化了数据库操作的...

    hibernate-release-4.1.4

    Hibernate是一个开源的对象关系映射(ORM)框架,它允许Java开发人员在处理数据库时使用面向对象的概念,极大地简化了数据库操作。此版本包含了Hibernate的核心库和其他相关组件,使得开发者能够将Java类与数据库表...

    hibernate-commons-annotations-5.0.1.Final.jar

    3. `org.hibernate.cfg`:这里的类主要用于配置和初始化Hibernate环境,如`AnnotationConfiguration`类就是配置Hibernate的入口,它会读取注解并生成相应的映射信息。 4. `org.hibernate.boot.model`和`org....

    HibernateTools-3.2.4.Beta1-R200810311334.zip

    《HibernateTools 3.2.4 Beta1:高效数据库管理和对象关系映射工具》 HibernateTools是Java开发者的重要辅助工具,它为Hibernate框架提供了一系列实用的集成开发环境(IDE)插件和命令行工具,极大地简化了数据操作...

    《精通Hibernate》学习-对象关系映射基础.zip

    《精通Hibernate》学习-对象关系映射基础 Hibernate是一个开源的对象关系映射(ORM)框架,它为Java开发者提供了一种方便地将数据库操作转换为面向对象的方式。在这个压缩包中,我们很可能会找到关于Hibernate基础...

    hibernate--- jar包

    4. **建立映射文件或使用注解**: Hibernate使用XML映射文件(.hbm.xml)或注解来定义对象与表之间的映射关系。注解方式更简洁,可以直接在实体类上定义。 5. **操作数据**: 通过Session对象进行数据库操作。增删...

    hibernate 全面学习->hibernate 关联映射学习

    首先,我们来看一下“一对多”(One-to-Many)的映射关系。在Hibernate中,这种关系通常用在一个实体可以拥有多个子实体的情况,如一个部门有多个员工。`hibernate_one2many_1`和`hibernate_one2many_2`的示例可能...

    hibernate-release-5.0.7.Final.zip

    - Object-Relational Mapping:通过XML或注解方式定义实体类和数据库表之间的映射关系,实现对象与数据的自动转换。 3. Hibernate 5.0.7.Final新特性 - 支持JSR-349 Bean Validation 1.1:增强了实体验证功能,...

    最新 hibernate-release-4.2.13.Final.tgz

    "hibernate-release-4.2.13.Final.tgz"是一个全面的Hibernate学习资源,不仅提供了运行环境所需的jar包,还包含了丰富的实践示例和详尽的文档。无论你是初学者还是经验丰富的开发者,都可以从中受益,进一步提升在...

    hibernate3-2 官方jar包+api

    Hibernate 是一个著名的开源对象关系映射(ORM)框架,它为Java开发者提供了便捷的数据持久化方式,使得在Java应用程序中操作数据库变得更加简单。这个“hibernate3-2 官方jar包+api”包含了 Hibernate 3.2 版本的...

    Hibernate hibernate-core-1a8aca9.ta

    Hibernate,作为Java领域最著名的对象关系映射(ORM)框架之一,极大地简化了数据库操作,使得开发者能够用面向对象的方式来处理数据,而无需关注底层的SQL语句。`hibernate-core-1a8aca9.ta`是Hibernate的核心组件...

    hibernate-annotations 相关jar包

    这些注解使得开发者可以更加直观地定义实体类及其与数据库表的映射关系,简化了传统的Hibernate XML配置文件。 **二、主要注解** 1. `@Entity`: 用于标记一个类为数据库中的实体类,对应于一张数据库表。 2. `@...

    Hibernate实体关联关系映射--学习总结.pdf

    Hibernate实体关联关系映射--学习总结.pdf

    韩顺平老师 hibernate3-3教学源码

    《韩顺平老师 Hibernate3-3 教学源码详解》 Hibernate,作为一个开源的对象关系映射(ORM)框架,是Java开发中的重要工具。它为开发者提供了在Java应用程序中操作数据库的强大支持,使得开发者无需关注底层SQL的...

    Hibernate_实体关联关系映射--学习总结

    同时,深入学习这些映射关系,不仅可以让我们更好地理解Hibernate的设计思想,还可以提升我们对他人代码的理解能力和代码质量。总之,系统学习和实践Hibernate实体关联映射是每一位Java开发者必备的技能。

    Hibernate---我的Hibernate学习笔记.doc

    ### Hibernate—我的Hibernate学习笔记 #### 一、对象持久化的理论与实践 ##### 对象持久化概念 对象持久化指的是将内存中的对象状态保存至外部持久性存储设备(如硬盘),以便于日后需要时能够恢复其状态。这一...

    hibernate-orm-master.zip

    Hibernate ORM(Object-Relational Mapping)是Java领域中最受欢迎的持久化框架之一,它提供了一种便捷的方式将Java对象映射到关系数据库,从而实现了对象-关系的解耦。"hibernate-orm-master.zip"文件包含了...

Global site tag (gtag.js) - Google Analytics