-->
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.  [ 1 post ] 
Author Message
 Post subject: Nhibernate Error with <idbag>
PostPosted: Thu May 07, 2009 11:07 am 
Newbie

Joined: Thu May 07, 2009 11:01 am
Posts: 1
I'm receiving an error when trying to map a many-to-many relationship using an <idbag>

everything works fine when I add one item to the collection and save but when I add a second item to the collection nhibernate does the two inserts and then tries to update the first records id to a 'System.Object' which in turn is throwing the error

Failed to COMMIT NHibernate transaction ---> System.InvalidCastException: Failed to convert parameter value from a Object to a Int32. ---> System.InvalidCastException: Object must implement IConvertible.

my mapping is below

Code:
<idbag
         name="mCollection"
         table="collection_xref"
         fetch="subselect"
         inverse="false"
         lazy="false"
         access="field"
          cascade="all-delete-orphan"
      >
      <collection-id column="id" type="int">
        <generator class="native">
          <param name="sequence">collection_xref_seq</param>
        </generator>
      </collection-id>
      <key column="class_a_id"></key>
      <many-to-many class="ClassB" column="class_b_id"></many-to-many>
    </idbag>


any help would be appreciated


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

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.