-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: MappingException: property mapping has wrong number of colum
PostPosted: Wed Feb 08, 2006 8:12 pm 
Newbie

Joined: Wed Feb 08, 2006 7:49 pm
Posts: 3
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!!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 08, 2006 9:38 pm 
Newbie

Joined: Wed Feb 08, 2006 7:49 pm
Posts: 3
Dont bother, I got it.

Apparently the problem was action_id is an int in the db but middlegen 2.0 (used it to my generate hbm files) made it of java.lang.Object type.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.