Is it valid for Hibernate list() to return duplicates?

Posted by skaffman on Stack Overflow See other posts from Stack Overflow or by skaffman
Published on 2009-10-13T13:25:48Z Indexed on 2010/04/14 0:23 UTC
Read the original article Hit count: 289

Filed under:
|

Is anyone aware of the validity of Hibernate's Criteria.list() and Query.list() methods returning multiple occurrences of the same entity?

Occasionally I find when using the Criteria API, that changing the default fetch strategy in my class mapping definition (from "select" to "join") can sometimes affect how many references to the same entity can appear in the resulting output of list(), and I'm unsure whether to treat this as a bug or not. The javadoc does not define it, it simply says "The list of matched query results." (thanks guys).

If this is expected and normal behaviour, then I can de-dup the list myself, that's not a problem, but if it's a bug, then I would prefer to avoid it, rather than de-dup the results and try to ignore it.

Anyone got any experience of this?

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate