-->
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.  [ 3 posts ] 
Author Message
 Post subject: Case insensitive searches, DBAs recommend nixing Hibernate!
PostPosted: Thu May 05, 2005 10:24 am 
Beginner
Beginner

Joined: Fri Aug 06, 2004 9:01 am
Posts: 21
Hibernate version: 3.0.2

Name and version of the database you are using:DB2 v7

OK, so the bottom line, per a previous thread I posted is that Criteria based queries with Expression.ilike on VARCHAR fields that hold values greater than 255 characters in DB2 v7 tank out because the LOWER() function used to perform the case insensitive searching fails due to:

SQL0171N The data type, length or value of argument "1" of routine "LCASE" is incorrect. SQLSTATE=42815

The DBAs recommend nixing Hibernate and doing straight JDBC to grab result sets and use Java based text parsing (regex or otherwise) to perform the case insensitive matching. Obviously grabbing the entire table for every search is not a solution I am willing to implement because DB2 v7 LOWER can't handle large values, so any H3 gurus have any recommendations on achieving case insensitive searching in DB2 on fields with values larger than 255 characters?


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 09, 2005 11:49 am 
Beginner
Beginner

Joined: Fri Aug 06, 2004 9:01 am
Posts: 21
*shameless bump*

Anyone have any suggestions on an implementation for this issue?


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 09, 2005 1:50 pm 
Regular
Regular

Joined: Mon Jul 26, 2004 2:28 pm
Posts: 86
Location: Pensacola, Florida
I've not worked with DB2, but is it possible to implement your own user functions? Suppose, for example, you create your own ILIKE( VARCHAR, VARCHAR ) function that returned 1 if the comparison matches, and 0 if not. You could then modify your Criteria query as follows:

Code:
session.createCriteria( MyClass.class )
   .add( /* Some Criterion */ )
   .add( /* Some other Criterion */ )
   .add( Expression.sql( "ILIKE( {alias}.column, ? ) = 1", someStringValue, Hibernate.STRING );


- Jesse


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

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.