mwang168 wrote:
Hi, I have the following query
select distinct parent from parent left join fetch child where parent.name like ?
return getSession()
.createQuery(hqlString)
.setString("searchString",name)
.setFirstResult(startPosition)
.setMaxResults(maxResult)
.list();
I keep getting duplicate parent back if parent has 1 or more children.
is the SQL correct? How to use distinct correctly?
The child is a set in parent defined in parent.hbm.xml.
thats correct put the list you are getting into set ... to remove dups