These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Case in-sensitive grouping using Criteria API
PostPosted: Thu Dec 04, 2008 3:49 pm 
Newbie

Joined: Mon Mar 03, 2008 12:25 pm
Posts: 2
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.