최대 절전 모드 joined-subclass
으로 클래스를 확장하고 싶습니다.Hibernate XML 복합 키로 서브 클래 싱하기
확장 클래스에는 합성 키가 있고 일반 클래스에는 일반적인 기본 키만 있습니다 (이미지 참조).
이 클래스 구조를 실현할 수있는 옵션이 있습니까?
는 현재 hbm.xml 그렇게 보이는 :
<?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="Product" table="products" catalog="test">
<id name="idProduct" type="java.lang.Integer">
<column name="idProduct" />
<generator class="identity" />
</id>
<property name="nameProduct" type="string">
<column name="name_Product" length="45" />
</property>
<property name="descriptionProduct" type="string">
<column name="description_Product" length="45" />
</property>
<property name="price1Product" type="string">
<column name="price1_Product" length="45" />
</property>
<property name="price2Product" type="string">
<column name="price2_Product" length="45" />
</property>
<joined-subclass name="ProductWithSelectedPrice" extends="Product" table="category_has_product">
<key>
<column name="Category_idCategory" />
<column name="Product_idProduct" />
</key>
<property name="price" type="java.lang.Integer" column="Product_selectedPrice" />
</joined-subclass>
-->
</class>
안부, 모든
내가 왜 그런 구조가 필요한지 알 수 있습니까? Hibernate는''내부에 복합 키를 허용하지 않는다. –
Amogh
이 다이어그램을 구현하는 또 다른 방법이 있습니까? 카테고리 (n : m)의 제품 가격을 선택하는 구조가 필요합니다. –