Main Contents

Duplicate entries in resultset of a hibernate query

general

If you have duplicate entries in a resultset of a hibernate query, then this could be caused by a eager fetchmode. A result is to add a ResulTransformer to your query.

Example:

Criteria criteria = getSession().createCriteria(Order.class);
criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);

More Infos here: https://www.hibernate.org/117.html#A12

jazzanowak @ February 25, 2010

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>


Feed