Reputation: 35
select * from Confirmation where (fee + extra) >= 12 ;
Hi guys, I want to know an easy way to get the total of two columns (fee + extra) which may possibly passed inside like :
DetachedCriteria criteria = DetachedCriteria.forClass(Confirmation.class)
criteria.add(Subqueries.propertyGe(".....", 12));
Upvotes: 0
Views: 1030
Reputation: 6576
You can try the following
DetachedCriteria criteria = DetachedCriteria.forClass(Confirmation.class)
criteria.setProjection(Projections.sqlProjection("fee + extra",new String(){"fee"},new Type(){Hibernate.Integer}));
Not tested, but, you will get the idea.
Upvotes: 1