2 Replies Latest reply on Oct 14, 2005 11:05 AM by Torbjørn Staff

    Possible bug with many OneToMany relation...

    Audun Wilhelmsen Newbie

      Have this situation:

      - subEntitys1 (OneToMany)
      - subEntitys2 (OneToMany)
      - subEntitys3 (OneToMany)

      Code is very simple,

      for MainEntity:

       @OneToMany(mappedBy="employee", cascade=CascadeType.ALL, fetch=FetchType.EAGER)
       public Collection<Education> getEducation() {
       return this.education;

       public Employee getEmployee() {
       return this.employee;

      The problem is that the result is a multiply of alle three subEntitys.

       MainEntity have...
       4 subEntitys1 (x=4)
       3 subEntitys2 (y=3)
       5 subEntitys3 (z=5)

      Then mainEntity.getSubEntitys1().size=60(x*y*z). This happend when you call getters more than once... Anyone with the same problem ? Will try to create a testcase, but now I use query to make a workaround...