Hibernate version: 3
Name and version of the database you are using: MySQL 5
Code:
Criteria crit;
Criteria critCount;
String col = conditions.getCondition(0).getColumn();
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
Date date=df.parse(conditions.getCondition(0).getValue());
crit = session.createCriteria(Person.class);
critCount = session.createCriteria(Person.class);
critCount.setProjection( Projections.rowCount() );
Criterion c = Restrictions.eq(col,date);
crit.add(c);
critCount.add(c);
/* Defines the ordering condition */
if(orderAsc) crit.addOrder(Property.forName(orderCol).asc());
else crit.addOrder(Property.forName(orderCol).desc());
crit.setMaxResults(pageSize);
crit.setFirstResult(firstRow);
Object total = critCount.uniqueResult();
List list = crit.list();
Well my purpose with this code, is to get a String converted it to a Date, according the format, and make a criteria based on that.
But i get no error output and it return 0 rows. Have I implemented something wrong on this code?