1 Reply Latest reply on Sep 7, 2007 3:05 PM by crafthell

    FDS and Hibernate many-2-many

      I have two tables: User and UserRelationship.
      UserRelationship table has only two fields: SuperiorId and SubordinateId, both of which are foreign keys for User table.

      I am currently able to display 3 data grids using Flex 2. In the first DG I have a list of Users, in the second DG I have a list of subordinates for the selected row in DG1, and in the third DG I have a list of Users that are NOT subordinates of the selected user in DG1.

      I would like to be able to select a user in the DG3, click a button and make his a subordinate of the selected user in DG1.

      I have tried several things, but nothing is working. I think I am missing something in the configuration file for FDS destination "user". Basically, the question is how to use update/delete/create on many-to-many relationships when I use Hibernate and FDS?

      Here is the snippet from my User.hbm.xml:

      <class name="User" table="user">
      <id name="id" type="java.lang.Integer">
      <column name="Id" />
      <generator class="native" />
      <property name="username" type="string">
      <column name="Username" length="30" not-null="true"/>
      <set name="usersForSuperiorId" inverse="true" table="userrelationship">
      <column name="SubordinateId" not-null="true"/>
      <many-to-many entity-name="User">
      <column name="SuperiorId" not-null="true"/>
      <set name="usersForSubordinateId" table="userrelationship">
      <column name="SuperiorId" not-null="true"/>
      <many-to-many entity-name="User">
      <column name="SubordinateId" not-null="true"/>

      Here is the snippet from data-management-config.xml:

      <destination id="user">
      <adapter ref="java-dao"/>
      <identity property="id"/>
      <paging enabled="true" pageSize="10"/>
      <throttle-inbound policy="ERROR" max-frequency="500"/>
      <throttle-outbound policy="REPLACE" max-frequency="500"/>
        • 1. Re: FDS and Hibernate many-2-many
          Galper or somebody, have you found the solution to do this ? I have a very similar problem with hibernate and many to many relations. In my case, wen I add another subordinate i receive an error of duplicate entry and I really don't know whats happenning. If you or another person have found a solution for this problem please share it in the forum.