A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Refactoring for Software Design Smells: Managing Technical Debt
this week in the
OO, Patterns, UML and Refactoring
Object Relational Mapping
Help Reg. DISTINCT ROOT Entity
Joined: Mar 01, 2002
Nov 02, 2006 11:50:00
I have a query:
In Criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); is Primary Key Column is DISTINCT_ROOT_ENTITY?
i have a table say
ID -- Country -- City
1 -- IN -- DEL
2 -- IN -- MUM
3 -- IN -- CHD
4 -- US -- NYC
5 -- US -- DEN
I am getting list representing ROW as an object. I want to get distinct 'country' records? here ID is Primary Key. how
DISTINCT_ROOT_ENTITY on country should be set?
Joined: Jun 19, 2001
Nov 03, 2006 05:42:00
show the query/criteria you are using.
Joined: May 16, 2005
Nov 06, 2006 00:25:00
getSession().createCriteria(Nations.class) .add(Restrictions.in("city",cityList)) .setProjection(Projections.property("country")) .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
[ November 06, 2006: Message edited by: Arun Kumarr ]
If you are not laughing at yourself, then you just didn't get the joke.
Have you checked out
subject: Help Reg. DISTINCT ROOT Entity
EJB Query Problem
what if no ID column in the table for Hibernate?
Hibernate Mapping problem because no primary key in database
about one to one
Queries on Entity Beans
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015