I'm retriving few columns using
ProjectionList projectionList = Projections.projectionList();
projectionList.add(Projections.property(propertyName), value);
criteria.setProjection(projectionList);
And i'm using a ResultTransformerClass also to transform my criteria result
criteria.setResultTransformer(Transformers.aliasToBean(TestResult.class));
This works fine if i dont have a "where" condition added.
But if i need to filter out only those records whose name like 'te%' ,Then
Hibernate generates query like:
select data as y0_, age as y1_, name as y2_ Employee
where y2_ ilike 'te%' ;
As in the where condition it's taking the alias name("y2_") the query is failing
saying "y2_" column Not found.
How can we explicitly say Hibernate not to use alias name in where condition
or to use the alias name that we specify?
|