hi everyone,
Im trying to order by a calculated field but has been no possible this is the code.
String sqlCountUserActions = "...";
ProjectionList projList = Projections.projectionList(); projList.add(Projections.property("id"),"id"); projList.add(Projections.property("name"),"name"); projList.add(Projections.sqlProjection(sqlCountUserActions, new String[] { "countActions" }, new org.hibernate.type.Type[] { Hibernate.LONG })); crit.addOrder((Order.asc("countActions")));
When I try this code always I got the error that 'countActions' doesnt exist in my class like a property... The class has got this property already with transient annotation because the property doesnt exist like a columna in the database..
What would be the solution
thanks in advance..
|