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: Restrictions.ilike is not working since hibernate4
PostPosted: Thu Dec 22, 2011 3:24 am 
Newbie

Joined: Thu Dec 22, 2011 3:09 am
Posts: 3
After switching from hibernate 3.6.8 to 4 using Oracle10gDialect the case insensitive Restrictions.ilike does not work any longer. The resulting sql shows a normal "where xyz like ?" instead of "where lower(xyz) like lower(?)".
I did not find any comments on this in the release notes or the migration guide. So I took a look in the source and found that with hibernate 4 a new method has been introduced in Dialect.java: "supportsCaseInsensitiveLike". This method returns false by default and is only overridden in PosgresSQLDialect.
Does anyone know why the OracleDialects do not support ilike any longer?
Thanks.


Top
 Profile  
 
 Post subject: Re: Restrictions.ilike is not working since hibernate4
PostPosted: Thu Dec 22, 2011 4:18 am 
Newbie

Joined: Thu Dec 22, 2011 3:09 am
Posts: 3
After some more searching in the sources i found the cause. It seems to be a bug that was introduced with HHH-4943:
The method Restrictions.ilike(String propertyValue, Object value) uses the LikeExpression-Constructor LikeExpression(propertyName, value.toString()) which will initialize LikeExpression with "ignoreCase = false".
I think this not the expected behaviour.

Workaround: Use Restrictions.ilike(String propertyValue, Object value, MatchMode mode).


Top
 Profile  
 
 Post subject: Re: Restrictions.ilike is not working since hibernate4
PostPosted: Thu Dec 22, 2011 4:31 am 
Newbie

Joined: Thu Dec 22, 2011 3:09 am
Posts: 3
Created a new issue for this:
https://hibernate.onjira.com/browse/HHH-6915


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.