-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: What does Criteria.DISTINCT_ROOT_ENTITY do ?
PostPosted: Tue Apr 27, 2010 5:25 am 
Newbie

Joined: Tue Apr 27, 2010 5:04 am
Posts: 3
Here is the sample code.

Criteria crit = session.createCriteria(Product.class);
crit.add(Restrictions.gt("price",new Double(1.0)));
crit.add(Restrictions.like("name","P%"));
crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);

What does Criteria.DISTINCT_ROOT_ENTITY do ?

Regards,
Rohit


Top
 Profile  
 
 Post subject: Re: What does Criteria.DISTINCT_ROOT_ENTITY do ?
PostPosted: Tue Apr 27, 2010 5:39 am 
Regular
Regular

Joined: Tue Jan 27, 2004 12:22 pm
Posts: 103
It inspects the resultset and insures that the resulting resultset does only contain distinct entities. Does exactly the same as HQL distinct function, only DISTINCT_ROOT_ENTITY does it in java. It's pretty usefull in some situations you can't use distinct in your HQL.

_________________
Dencel
- The sun has never seen a shadow -


Top
 Profile  
 
 Post subject: Re: What does Criteria.DISTINCT_ROOT_ENTITY do ?
PostPosted: Tue Apr 27, 2010 7:47 am 
Newbie

Joined: Tue Apr 27, 2010 5:04 am
Posts: 3
Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.