---
title: "为什么要有单向关联"
author: "east_java"
date: "2010-02-07T21:36:48Z"
tags: []
categories: ["企业架构"]
slug: "untitled"
draft: false
lastmod: "2010-02-07T21:36:48Z"
id: 591151
url: "https://japi.iteye.com/blog/591151"
---

[http://www.java1995.cn/blog/item/113](http://www.java1995.cn/blog/item/113)

 

 

 

hibernate官方推荐使用双向关联，那么单向关联有什么用呢？

其实这个有用没用，不是从技术方向来解释的，而应该从业务层来考虑。

比如：

user &lt;--&gt; city ；  
     class user{  
         city;  
    }  
    不需要  
    class city{  
          //    List users;    // this is unnecessary for business , 不需要 .  
    }  
    对象层不需要，persistance 层 当然不需要了。就省了吧。

这就是为什么要留有单向关联的原因。