Hi all,
here are my mapping files :
Code:
<hibernate-mapping>
<class name="com.foo.bar.InitResourceAction"
table="init_resource_actions">
<meta attribute="class-description" inherit="false">
@hibernate.class table="init_resource_actions"
</meta>
<id name="resActionId" type="java.lang.Object"
column="RES_ACTION_ID">
<meta attribute="field-description">
@hibernate.id generator-class="assigned"
type="java.lang.Object" column="RES_ACTION_ID"
</meta>
<generator class="assigned" />
</id>
<property name="resourceValue" type="java.lang.String"
column="RESOURCE_VALUE" length="30">
<meta attribute="field-description">
@hibernate.property column="RESOURCE_VALUE" length="30"
</meta>
</property>
<!-- bi-directional many-to-one association to InitAction -->
<many-to-one name="initAction"
class="com.foo.bar.InitAction" not-null="true">
<meta attribute="field-description">
@hibernate.many-to-one not-null="true" @hibernate.column
name="ACTION_ID"
</meta>
<column name="ACTION_ID" />
</many-to-one>
</class>
</hibernate-mapping>
<hibernate-mapping>
<class name="com.foo.bar.InitAction" table="init_actions">
<meta attribute="class-description" inherit="false">
@hibernate.class table="init_actions"
</meta>
<id name="actionId" type="java.lang.Object"
column="ACTION_ID">
<meta attribute="field-description">
@hibernate.id generator-class="assigned"
type="java.lang.Object" column="ACTION_ID"
</meta>
<generator class="native" />
</id>
<!-- Associations -->
<!-- bi-directional one-to-many association to InitResourceAction -->
<set name="initResourceActions" lazy="true" inverse="true"
cascade="none">
<meta attribute="field-description">
@hibernate.set lazy="true" inverse="true" cascade="none"
@hibernate.collection-key column="ACTION_ID"
@hibernate.collection-one-to-many
class="siliconsole.hibernate.InitResourceAction"
</meta>
<key>
<column name="ACTION_ID" />
</key>
<one-to-many class="com.foo.bar.InitResourceAction" />
</set>
</class>
</hibernate-mapping>
And i get the following exception:
Quote:
Caused by: org.hibernate.MappingException: property mapping has wrong number of columns: com.foo.bar.InitResourceAction.initAction type: com.foo.bar.InitAction
action_id is the primary key in init_actions table and foreign key in init_resource_actions table.
Can someone please help me solve this mapping issue.
Thanks!!