2. Click Add Button
Select Filter type as “Exclude ALL” and Applies to “Folders” and Select “All Children” and Type .svn for File and Folder Attributes
Click ok and now the .svn folder will not be listed in the Eclipse Explorer.
Click ok and now the .svn folder will not be listed in the Eclipse Explorer.
if (laborderConditions.getBalanceStatus() != null) {
if (laborderConditions.getBalanceStatus().equalsIgnoreCase("Open")) {
criteria.add(Restrictions
.sqlRestriction("IFNULL(amount,0)=IFNULL(balance,0)"));
}
}
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";
}
});
Here is the small code snippet from my current project to retrieve the records between two date. User will just enter the date part with year, month and date, but the DB Contains date and time value.
if (laborderConditions.getFromDOE() != null) {
criteria.add(Restrictions.ge("createdDate",
getFormattedFromDateTime(laborderConditions.getFromDOE())));
}
if (laborderConditions.getToDOE() != null) {
criteria.add(Restrictions.le("createdDate",
getFormattedToDateTime(laborderConditions.getToDOE())));
}
private Date getFormattedFromDateTime(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
return cal.getTime();
}
private Date getFormattedToDateTime(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
return cal.getTime();
}