Hibernate Criteria Duplicate Records Issue [Solved]

Hibernate Criteria Duplicate Records Issue: Problem: Duplicate same records with hibernate join. In Hibernate if we did join, we may get duplicates sometime. Below are the possible ways to resolve the duplicate same record value issue, Possible Solutions: 1. criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); 2. criteria.setProjection(Projections.distinct(Projections.property(“id”))); 3. criteria.setProjection(Projections.distinct(Projections.id())); Recommended Solution: criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); If nothing is working then change the list to set, so that duplicates

214 total views, 3 views today

» Read more