From: Artti J. (JIRA) <no...@at...> - 2005-08-29 11:23:57
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HB-520?page=comments#action_19631 ] Artti Jaakkola commented on HB-520: ----------------------------------- Problem with setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY) is that it's done only after the query is executed. If you happen to have criteria.setMaxResults(10) and first 8 items equal with each other, then you get only 3 items as a result: List results = session .createCriteria(User.class) .setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY) .setMaxResults(itemCount.intValue()) .list(); Now I don't know if I should fetch all the items from database and then just cut the first 10 or what... > Add Distinct to Criteria API > ---------------------------- > > Key: HB-520 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HB-520 > Project: Hibernate2 > Type: New Feature > Components: core > Versions: 2.1 rc1 > Environment: Hibernate 2.1+, (Any DB) > Reporter: Stephen Owens > Priority: Minor > > > Need the ability to specify that results of a Criteria query should be 'DISTINCT', especially when joining to a collection. So the Criteria equivalent of the HQL statement > "select distinct parent from Parent as parent join Parent.children as child where child.age>5" -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |