0
我是新来的休眠(有c背景),虽然经历了一些书籍和例子,我总是看到组件嵌入类映射。例如hibernate可以组件是全局的吗?由其他实体共享?
<hibernate-mapping>
<class name="com.mkyong.customer.Customer" table="customer">
<!-other entity mapping -->
<component name="Address" class="com.mkyong.customer.Address">
<property name="address1" type="string">
<column name="ADDRESS1" not-null="true" />
</property>
<property name="address2" type="string">
<column name="ADDRESS2" not-null="true" />
</property>
</component>
.
.
</class>
</hibernate-mapping>
我的问题是可以组件是全局的,并由任何实体共享?像@Embeddable JPA注释
我指的是在例如:http://www.mkyong.com/hibernate/hibernate-component-mapping-example/
你问是否有其他组件可以引用这个组件?如果是这样,那么是的。 –
任何其他组件或其他实体,如果是的话可以请提供一些例子? – stultus
已发布一个答案 –