問題を理解する...どのようにしてこのハイバネートマッピングを行うことができますか?
私は特定のテーブルに関連するテーブルのグループを持っています。すべてのものと "table_one"の関係を行うために、私はプライマリキーとして次のように構成されているテーブルのみを作成しました:
id_table_one、id_table_many、id_table_many_type。
最初のものはtable_oneのidを示し、2番目のものはtable_many(いずれも)のIDを示し、3番目のキーはテーブルのタイプを示す文字列です。
例は、具体的には:
1、1、 "表1" - >はtable_one
の行1 table_many "表1"(行1)の関係を示しています表3は、table_many「table1」(行5)とtable_oneの行3との関係を示す。
3,5「table2」 - >は、 table_many "table 2"(行5)、table_oneの行3と
これは簡単ですSQLで行うには、問題は、どのように各テーブル_Manyでハイバネートマッピングを行うことができますか?
次のように私はtable_oneを宣言:
<class name="tableOne" table="table_one">
<composite-id>
<key-property name="idTableOne" type="java.lang.Integer">
<column name="id_table_one" not-null="true"/>
</key-property>
<key-property name="idTableMany" type="java.lang.Integer">
<column name="id_table_many" not-null="true"/>
</key-property>
<key-property name="idTableManyType" type="string">
<column name="id_table_many_type" length="100" not-null="true"/>
</key-property>
</composite-id>
</class>
は、どのように私は多くのテーブルに行うことができますか?
<class name="tableMany1" table="table_many_1">
<id name="idTableMany1" type="java.lang.Integer">
<column name="id_table_many_1" />
<generator class="identity" />
</id>
<set cascade="all" name="tableOneRows" sort="unsorted"
table="table_one" lazy="false">
<...>
</set>
</class>
私は... < ...>セクション内の任意のアドバイスを記入する方法がわかりませんか?
私が追求しています終局は、各tableManyからtableOne(リード/ライト)...
THXすべてを管理することです!