首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Hibernate 字段配备关系

2013-02-15 
Hibernate 字段配置关系根据业务需求在两张表中加了两个字段做个总结:column为实体中的字段名称 (基础表的

Hibernate 字段配置关系

根据业务需求在两张表中加了两个字段

做个总结:

column为实体中的字段名称 (基础表的字段)

name为自己指定的虚拟名称

Llt_Org_Info表中show_category字段与llt_system_code表中code字段配置关联关系

之前配置

<many-to-one name=" show_category?" column="type" not-null="true"/>

错误1:column应为实体中的字段名称 (本想直接关联上llt_system_code表的type字段,测试后配置错误)

Llt_Org_Info?基础表中xml中增加配置

<property name="show_category" column="show_category" type="string" not-null="false" length="500" />

?

<property name="recommend_flag" column="recommend_flag" type="string" not-null="false" length="1"/>

llt_system_code表中xml 配置

<id name="id" type="integer" column="id"><generator column="name" type="string" not-null="true" length="100"/>

<property name="code" column="code" type="string" not-null="true" length="10"/>

<property name="type" column="type" type="string" not-null="true" length="2"/>

?

hibernate中只需指定字段的基本信息hql查询时,就会根据表的id自带关联上其他属性将其引出

热点排行