0

私は3つのテーブルを持っています:

Table A(Col1,Col2,Col3) -- Col1 Primary Key
Table B(Col4,Col5,Col6) -- (Col4,Col5) --Composite Key
Table C(Col7,Col8,Col9,Col10) --(Col7,Col8,Col9) -- Composite key References (Col1,Col4,Col5)

hibernateこのテーブル C のマッピングはどのように行われますか?

4

1 に答える 1

0

内部に複合キーを含む複合キーを作成することはできませんか?

このようなもの:

<composite-id name="id" class="com.domain.CompositeTableC">
    <key-property name="col1" type="string">
        <column name="Col1" length="8" />
    </key-property>
    <key-property name="col4" type="string">
        <column name="Col4" length="8" />
    </key-property>
    <key-property name="col5" type="string">
        <column name="Col5" length="8"/>
    </key-property>
</composite-id> 

そしてクラス:

public class CompositeTableC{
//constructors
private String col1;
private CompositeTableB compositeB;
//getters and setters
}

public class CompositeTableB {
//constructors
private String col4;
private String col5;
//getters and setters
}
于 2013-08-05T04:05:40.583 に答える