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:
<hibernate-mapping>
<class name="User" table="user">
<id name="id" type="java.lang.Integer">
<column name="Id" />
<generator class="native" />
</id>
<property name="username" type="string">
<column name="Username" length="30" not-null="true"/>
</property>
<set name="usersForSuperiorId" inverse="true"
table="userrelationship">
<key>
<column name="SubordinateId" not-null="true"/>
</key>
<many-to-many entity-name="User">
<column name="SuperiorId" not-null="true"/>
</many-to-many>
</set>
<set name="usersForSubordinateId"
table="userrelationship">
<key>
<column name="SuperiorId" not-null="true"/>
</key>
<many-to-many entity-name="User">
<column name="SubordinateId" not-null="true"/>
</many-to-many>
</set>
</class>
</hibernate-mapping>
Here is the snippet from data-management-config.xml:
<destination id="user">
<adapter ref="java-dao"/>
<properties>
<use-transactions>true</use-transactions>
<source>flex.data.assemblers.HibernateAssembler</source>
<scope>application</scope>
<metadata>
<identity property="id"/>
</metadata>
<network>
<paging enabled="true" pageSize="10"/>
<throttle-inbound policy="ERROR" max-frequency="500"/>
<throttle-outbound policy="REPLACE"
max-frequency="500"/>
</network>
<server>
<hibernate-entity>com.ivas.User</hibernate-entity>
<update-conflict-mode>PROPERTY</update-conflict-mode>
<delete-conflict-mode>OBJECT</delete-conflict-mode>
<fill-method>
<name>fill</name>
<params>java.util.List</params>
</fill-method>
<fill-configuration>
<use-query-cache>false</use-query-cache>
<allow-hql-queries>true</allow-hql-queries>
</fill-configuration>
</server>
</properties>
</destination>