4 Replies Latest reply on Jan 17, 2007 9:28 AM by dimival

    Using an Object as the identity property for a destination

    dimival Level 1
      I am using the DataServices and Java Assemblers in my application but there seems to be a problem with one of my Java POJOs. First let me explain about my application, the java-side is using Hibernate, so my POJOs are mapped to a database's entities. I know there is a Hibernate Assembler but i can't use it because besides Hibernate I am using EJB and Spring on the java-side, so that's why i am using the Java Assembler instead of the Hibernate one.

      Ok so now moving along, there's a POJO that has a composite ID, in Hibernate in order to do this you need an Object which will be the composite ID. Here's the example:

      Class GroupRole {
      public GroupRoleID id;
      Class GroupRoleID {
      public Integer rolId;
      public Integer groupId;

      On Flex i did the same:

      Class GroupRole {
      public var id : GroupRoleID;

      Class GroupRoleID {
      public var rolId : Number;
      public var groupId : Number;

      Now on my data-management.xml i have the folowing destination:
      <destination id="groupsRoles">
      <adapter ref="java-dao" />
      <identity property="id " type="GroupRoleID"/>

      Now when i call the fill method on the assembler to get a list of GroupRole objects, something weird happens on the Datagrid, it shows the registers but only one of them can be selected, for example, if the fill returns 4 registers the DataGrid shows 4 registers that look EXACTLY THE SAME and when i try to select one of them, only the last one can be selected, the other 3 can't as if they were not there.

      So what's wrong with this? Like i said it happens when you declare an object as the identify property in the destination. I am assuming that this is not supported and if it is does anyone know how do make it work? What is needed in order to work with objects which identity property is an object?