component(组件映射)
在hibernate中,component是某个实体对象的逻辑组成部分,它与实体的根本区别是
component是没有标识的,它是一个逻辑组成部分,完全从属于某个实体
这样就在传统数据库上,实现了对象的细粒度划分,层次分明,实现了面向对象的领域划分
在hibernate中,component是某个实体对象的逻辑组成部分,它与实体的根本区别是
component是没有标识的,它是一个逻辑组成部分,完全从属于某个实体
这样就在传统数据库上,实现了对象的细粒度划分,层次分明,实现了面向对象的领域划分
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.bjsxt.hibernate.User" table="t_user">
<id name="id">
<generator class="native"/>
</id>
<property name="name"/>
<component name="contact">
<property name="address"/>
<property name="contactTel"/>
<property name="email"/>
<property name="zipCode"/>
</component>
</class>
</hibernate-mapping>
本文介绍了Hibernate中组件映射的概念及使用方式,通过实例展示了如何将实体对象的逻辑部分进行细粒度划分,并实现面向对象的领域划分。
832

被折叠的 条评论
为什么被折叠?



