---
title: "hibernate映射的一些疑惑"
author: "javaEEdevelop"
date: "2013-01-29T14:42:20Z"
tags: []
categories: ["开源软件"]
slug: "hibernate"
draft: false
lastmod: "2013-01-29T14:42:20Z"
id: 1778859
url: "https://javaeedevelop.iteye.com/blog/1778859"
---

```
1.一对多
	一对多是站在多的一方中映射xml中来分析的,比如:teacher.hbm.xml
		<set name="student" inverse="false" lazy="false" cascade="all-delete-orphan" order-by="resourceId">
			<key>
				<column name="teacher_id"></column>
			</key>
			<one-to-many class="org.onetomany.Student/>
		</set>
2.多对一
	多对一是站在多的一方中映射xml中来分析的,比如:student.hbm.xml
	<many-to-one name="teacher" class="org.onetomany.Teacher">
			<column name="teacher_id"></column>
		</many-to-one>
3.一对一
  <one-to-one name="student" class="org.onetoone.Student" cascade="all"/>

  <one-to-one name="teacher" class="org.onetoone.Teacher" cascade="all"/>
```