0 Replies Latest reply on Jun 25, 2010 5:14 AM by PHANTOMIASA

    BlazeDS -> n:m relation with eager loading -> recursion?

    PHANTOMIASA

      Hello to all!

       

      I have a n:m relation and I do eager loading with Hibernate (and other relations with 1:n and n:m, but not displayed here):

       

      @ManyToMany(fetch=FetchType.EAGER)
          @JoinTable(name = "Group_User",
              joinColumns = {@JoinColumn(name="group_id", referencedColumnName="id")},
              inverseJoinColumns = {@JoinColumn(name="user_id", referencedColumnName="id")}
          )
      @Fetch(FetchMode.SELECT)
      private List<User> users;
      
      
      @ManyToMany(mappedBy="users", fetch=FetchType.EAGER)
      @Fetch(FetchMode.SELECT)
      private List<Group> groups;
      

       

      So one user can have several groups and in one group can be several users.

       

      So, but now I get all groups in Flex frontend and so I have also all users included, but the problem is, I get a kind of recursion here.

      Debugging it and take a look at the groups, I see the users listed, and the user have groups, and these groups have users and so on and so on...

       

      What shoud I do to solve this problem?

       

      Thanks a lot in advance & Best Regards PHANTOMIAS