hibernates でクラスを拡張したいjoined-subclass
。
問題は、拡張クラスには複合キーがあり、通常のクラスには通常の主キーしかないことです (画像を参照)。
このクラス構造を実現するオプションはありますか?
現在、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>
よろしくお願いします、