| We could close it as duplicated as reported by Gunnar Morling. The problem is that Bags allow duplicates so we cannot easily apply a deduplication especially since that would break valued-collections are meant to contain duplicates. The problem here comes from joining on multiple levels, so one record on the second level (Branch) is contained multiple times in the ResultSet for every child entry on the third level. Nevertheless, this issue can only happen if EAGER fetching is enabled for collections, which is a much bigger issue in itself. Nevertheless, after investigating the code, I realized that the issue requires some extensive refactoring because the PersistentBag#readFrom cannot determine if the presence of duplicates in intended (e.g. a collection of String values of what events happened "rock", "scissor", "scissor") or the duplicates are caused by a multi-level join. The workaround is to either use Sets or to use LAZY loading. |