hibernate 中many-to-one association (1)
来源:互联网 发布:电脑收银软件 编辑:程序博客网 时间:2024/05/29 15:13
以<Categary> 和<Item> 为例。
categary_id, Item表中定义了fk,reference to categary 表中的categary_id.
在Item hibernate定义中,不需要指定<property name="categry_id" type="integer" />
否则就必须在<many-to-one>中,指定 insert="false" update="false".如果没有定义则报错。
测试程序很简单,Item i1=(Item)session.get(Item.class, new Integer(3));
然后就i1.getName();
i1.getCategary.getName();
观察console会发现只有access Categary的时候,hibernate 会根据categary_id , select categary get the row。
- hibernate 中many-to-one association (1)
- hibernate 单向one-to-many association(1)
- hibernate 单向many-to-one association (2)
- hibernate 单向one-to-many association
- why inverse must be setted in hibernate bidirectional association of one-to-many and many-to-many
- hibernate many-to-one // one-to-many
- Hibernate中实现one-to-many
- hibernate中one-to-many实例一
- hibernate中many-to-one实例一
- hibernate many-to-one
- hibernate one to many
- Hibernate one-to-many
- hibernate:many to one
- hibernate--one-to-many
- hibernate中hbm.xml<many-to-one><one-to-many>中一些属性详解
- 关于Hibernate中many-to-one和one-to-many的一些理解
- Hibernate中的one-to-many
- Hibernate的one-to-many
- C/C++中const详解
- 关于sizeof()的一些思考
- 函数指针和指针函数
- postgresql 操作介绍
- 模板分析
- hibernate 中many-to-one association (1)
- C#數據庫訪問
- ASP.NET中调用存储过程
- IBM lotus Notes change working directory
- Javascript求一天數之後的日期
- hibernate 单向many-to-one association (2)
- js共公函數
- ajax操作xml文件
- HTTP 1.1/500解决:服务器无法加载应用程序 ????/LM/W3SVC????。错误是 ????找不到指定的元数据????。 - MGIS - CSDNBlog