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>