Wednesday, 9 July 2014

Hibernate Sort String field after changing to Integer

	Criteria criteria = getCurrentSession().createCriteria(LabOrder.class);

criteria.createAlias("practice", "pract", JoinType.INNER_JOIN);
criteria.createAlias("patient", "pat", JoinType.INNER_JOIN);
criteria.createAlias("labpanel", "panel", JoinType.LEFT_OUTER_JOIN);
criteria.addOrder(new org.hibernate.criterion.Order("orderNo", true) {
@Override
public String toSqlString(Criteria criteria,
CriteriaQuery criteriaQuery) throws HibernateException {
return "cast(orderNo as UNSIGNED) desc";
}
});

2 comments:

Passing Parameter between two files using MVVM

This examples shows how to pass parameter between two zul screens. In this example, we are passing some parameters from the parent vm to...