Hibernate version: 3.2.5
Code between sessionFactory.openSession() and session.close():
final Criteria hibernateCriteria =
session.createCriteria( Item.class,"Item" );
hibernateCriteria.setProjection( Projections.projectionList()
.add( Projections.rowCount() )
.add( Projections.groupProperty( "description" ) ) );
final List<Object[]> rows = (List<Object[]>) hibernateCriteria.list();
Name and version of the database you are using: Firebird 2.0
Now, when the "description" column has 3 values like "Test", "Test" and "TEST".
The above criteria gives 2 rows:
Quote:
count description
-------------------------
2 Test
1 TEST
But, I want:
Quote:
count description
-------------------------
3 test
This can be done in sql like:
Code:
SELECT COUNT(*), LOWER(DESCRIPTION) FROM ITEM GROUP BY LOWER(DESCRIPTION)
Just want to know how to achieve the same using Criteria API.
Thanks