Topic: hibernate的关联关系问题 |
Print this page |
1.hibernate的关联关系问题 | Copy to clipboard |
Posted by: jweban Posted on: 2005-05-31 20:16 我现在有两个表A,B 在某种情况下我想让A,B有双向一对多关系,这一点比较容易实现。 而在另一种情况下,我想让A,B之间不关联。 可是在a.hbm.xml,b.hbm.xml中把关联关系配置好了以后,如何才能在程序中动态的控制去掉关联关系。 不知道我说明白了没有,还请多多指教。 |
2.Re:hibernate的关联关系问题 [Re: jweban] | Copy to clipboard |
Posted by: wldandan Posted on: 2005-06-19 15:06 不会把 你什么时候见数据库设计完了 有时候不关联,有时候关联的。。。。 hibernate相当于你的数据库的映射 |
3.Re:hibernate的关联关系问题 [Re: jweban] | Copy to clipboard |
Posted by: jweban Posted on: 2005-06-20 08:25 也就是说,原则上A与B是有关联关系的, 可是在有些时候我只需要A的数据,为了提高访问效率,这时我不想同时把B表一起检索。 另一些时候我需要两个表的数据,这样利用它的关联关系,很容易得到。 |
4.Re:hibernate的关联关系问题 [Re: jweban] | Copy to clipboard |
Posted by: edward Posted on: 2005-07-17 00:35 1、分别在a.hbm.xml及b.hbm.xml中的class中加入lazy="true" 。 2、在关联的地方加入lazy="true"。 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |