码迷,mamicode.com
首页 > Web开发 > 详细

Hibernate 单项多对一映射

时间:2016-08-18 21:08:29      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:

 

public class Order {
private Integer orderId;
private String orderName;


private Customer customer;

}

public class Customer {
private Integer customerId;
private String sustomerName;
}

在映射多对一的关联关系时,使用 many-to-one 来映射多对一的关联关系。

<many-to-one name="customer" class="Customer" column="CUSTOMER_ID"></many-to-one>

name : 是一这一端中对应的多的那一端的 名字。

class :是一那一端的属性对应的类名。

column :是一那一端在多的一端对应的数据表中的外键的名字。

 

Hibernate 单项多对一映射

标签:

原文地址:http://www.cnblogs.com/j05ahua/p/5785146.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!