I just cant seem to come up with a valid mapping.
Code:
<hibernate-mapping>
<class name="mypackage.Tokens" table="TOKENS"
schema="PUBLIC">
<composite-id name="id"
class="mypackage.TokensId">
<key-property name="appid" type="string">
<column name="APPID" length="34" />
</key-property>
<key-property name="token" type="string">
<column name="TOKEN" length="128" />
</key-property>
</composite-id>
<set name="belongsTo" table="TokenGroups">
<key column="Tokens"/>
<many-to-many column="GroupsId" class="mypackage.Groups"/>
</set>
</class>
</hibernate-mapping>
Code:
<hibernate-mapping>
<class name="mypackage.Groups" table="GROUPS"
schema="PUBLIC">
<composite-id name="id"
class="mypackage.GroupsId">
<key-property name="appid" type="string">
<column name="APPID" length="34" />
</key-property>
<key-property name="groupname" type="string">
<column name="GROUPNAME" length="128" />
</key-property>
</composite-id>
<set name="members" inverse="true" table="UserGroups">
<key column="GroupID"/>
<many-to-many column="UserID" class="mypackage.Users"/>
</set>
<set name="tokenSet" inverse="true" table="TokenGroups">
<key column="Group"/>
<many-to-many column="Token" class="mypackage.Tokens"/>
</set>
</class>
</hibernate-mapping>
this seems to be close, but I get a complaint about not having enough columns in the foreign key relationship
Code:
org.hibernate.MappingException: Foreign key (FKF5E4090D1085596A:TokenGroups [Token])) must have same number of columns as the referenced primary key (TOKENS [APPID,TOKEN])
I've been reading through the documentation, and googling, but I have yet to find something that points me n the right direction