-->
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: Bidirektionale Assoziation mit composite-element
PostPosted: Fri Aug 12, 2005 10:37 am 
Newbie

Joined: Fri Aug 12, 2005 10:15 am
Posts: 2
Hallo,

ich versuche ein bidirektionales Many-To-Many Mapping ans Laufen zu kriegen. User <--> Location. Die Assoziationstabelle brauche ich um das Attribut writeAccess zu speichern.

Ich bekomme in der Applikation nun folgenden Fehler:
Code:
IllegalArgumentException in class: UserLocationAccess, setter method of property: Location
expected type: Location, actual value: User


Ich glaub ich seh' den Wald vor lauter Bäumen nicht. Die Klasse UserLocationAccess ist eigentlich ok. Ich glaube es lieht eher am Mapping. Hat irgend jemand einen Tip?

Das Mapping sieht so aus:

Code:
<class name="User" table="`User`">
   <id name="ID" column="`USER_ID`" type="java.lang.Long">
      <generator class="native" />
   </id>
   <property name="Login" unique="true" not-null="true" />
   <property name="Password" not-null="true" />
   <property name="Firstname" />
   <property name="Lastname" />

   <set name="locations" lazy="true" table="`user_location_access`">
      <key column="`USER_ID`" />
      <composite-element
         class="UserLocationAccess">
         <parent name="Location" />
         <many-to-one name="location" column="`LOCATION_ID`"
            class="Location" not-null="true" />
         <property name="writeAccess" column="`writeAccess`"
            type="true_false" not-null="true" />
      </composite-element>
   </set>

</class>

<class name="Location" table="`Location`">
   <id name="ID" column="`LOCATION_ID`" type="java.lang.Long">
      <generator class="native" />
   </id>

   <property name="Name" not-null="true" />

   <set name="users" lazy="true" table="`user_location_access`"
      inverse="true">
      <key column="`LOCATION_ID`" />
      <composite-element
         class="UserLocationAccess">
         <parent name="User" />
         <many-to-one name="location" column="`USER_ID`"
            class="User" not-null="true" />
         <property name="writeAccess" column="`writeAccess`"
            type="true_false" not-null="true" />
      </composite-element>
   </set>
</class>



Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 12, 2005 10:39 am 
Newbie

Joined: Fri Aug 12, 2005 10:15 am
Posts: 2
Achja, Hibernate 3. :)


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.