私にはAction
エンティティがありAction
、双方向の1対多の関係で他のオブジェクトを子として持つことができます。問題は、Hibernateが次の例外を出力することです。
「コレクションのマッピングで繰り返される列:DbAction.childs列:actionId」
マッピングのコードの下:
<?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="DbAction" table="actions">
<id name="actionId" type="short" />
<property not-null="true" name="value" type="string" />
<set name="childs" table="action_action" cascade="all-delete-orphan">
<key column="actionId" />
<many-to-many column="actionId" unique="true" class="DbAction" />
</set>
<join table="action_action" inverse="true" optional="false">
<key column="actionId" />
<many-to-one name="parentAction" column="actionId" not-null="true" class="DbAction" />
</join>
</class>
</hibernate-mapping>