Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Regarding DMI mapping with DataSource.

    Hi,
    I am using DMI-spring-hibernate. I have a scenario like populating Role table records in roles list grid and up on clicking on particular role record I have to show the assigned users in users list grid. The relation ship between roles and the users is many-to-many. I am able achieve data in the userRoleDMI, but I don't know how to map the userRole collection in DataSource, So that I can achieve user data in another listgird. For now I am succesfully achieved roles information in roles list grid ..But related users information mapping in Datasource is the problem. Please help me more details below and help me in this regard.

    Properties of Role.java
    ----------------------
    roleId number
    roleNm String
    userRoles Collection-- this collections contains UserRole.java objects.

    Properties of User.java
    -----------------------
    userId number
    userNm String

    Properites of UserRole.java
    -------------------------
    userRoleId number
    user User--It is user object
    role Role-- It is role object


    In my DMI I have data for the entire roles and their collection userroles. But I am not getting idea of mapping user details in below Datasource, so that I can achieve related users data in userslistgrid.

    Code:
    <DataSource
        ID="userRoleDS"
        serverType="generic">
        <fields>
            <field name="roleId"      type="sequence" hidden="true"       primaryKey="true"/>
            <field name="roleNm"    type="text"     title="Name"        length="128"       required="true"/>
    <!-- guide me how to configure users here-->
        </fields>
    
        <serverObject lookupStyle="spring" bean="userRoleDMI"/>
    
    
    
    </DataSource>

    #2
    You want a separate "users" DataSource, with a foreignKey to the "roles" DataSource, where "fetch" on the users DataSource is able to receive a "roleId" as criteria and return corresponding users. Then just call fetchRelatedData on the grid that shows the users.

    Comment


      #3
      "where "fetch" on the users DataSource is able to receive a "roleId" as criteria and return corresponding users. Then just call fetchRelatedData on the grid that shows "

      Could you explain what this means?
      Does this mean that there is another "fetch" operation defined in the ds xml Ex: "fetchByRoleId" which retrieves users based on the criteria "roleId" - and the listgrid makes a fetch call with the operation id "fetchByRoleId"

      then what does the fetchRelatedData do?

      Comment

      Working...
      X