Hello,
I am trying to use criteria query using example and trying to resolve this since last few days. I need to use projection with the example query to get only certain properties - I am trying following, but it is not working.
User usr = new User();
usr.setCity = 'TEST';
getCurrentSession().createCriteria(User.class)
.setProjection( Projections.distinct( Projections.projectionList()
.add( Projections.property("name"), "name")
.add( Projections.property("city"), "city")))
.add( Example.create(usr))
The generated sql keeps having a where class refering to just y0_= ? instead of this_.city.
So, I was wondering is criteria query with example supported for projection? how can I have only certain properties queried using example query?
|