[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-2997) LikeExpression case sensitive not working properly

Adam Czysciak (JIRA) noreply at atlassian.com
Wed Mar 26 03:50:35 EDT 2008


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2997?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Czysciak updated HHH-2997:
-------------------------------

    Attachment: hibernate2997test.zip

Attached a test case - bug occurs on Hibernate 3.2.6 as well.

Adding Expression.like() and Expression.like().ignoreCase() to the Criteria works ok.

Adding custom Expression (own class extending LikeExpression) doesn't work for ignoreCase=false - Hibernate always binds toLower()'ed value of the pattern.

Test output:

Hibernate: select test_seq.nextval from dual

Hibernate: insert into test (text, ID) values (?, ?)
DEBUG org.hibernate.type.StringType  - binding 'XyZ uniq1206517288290 blablabla' to parameter: 1
DEBUG org.hibernate.type.IntegerType  - binding '16' to parameter: 2

Hibernate: select this_.ID as ID0_0_, this_.text as text0_0_ from test this_ where this_.text like ?
DEBUG org.hibernate.type.StringType  - binding 'XyZ uniq1206517288290%' to parameter: 1
DEBUG org.hibernate.type.IntegerType  - returning '16' as column: ID0_0_
DEBUG org.hibernate.type.StringType  - returning 'XyZ uniq1206517288290 blablabla' as column: text0_0_

Hibernate: select this_.ID as ID0_0_, this_.text as text0_0_ from test this_ where lower(this_.text) like ?
DEBUG org.hibernate.type.StringType  - binding 'xyz uniq1206517288290%' to parameter: 1
DEBUG org.hibernate.type.IntegerType  - returning '16' as column: ID0_0_
DEBUG org.hibernate.type.StringType  - returning 'XyZ uniq1206517288290 blablabla' as column: text0_0_

Hibernate: select this_.ID as ID0_0_, this_.text as text0_0_ from test this_ where lower(this_.text) like ? escape '\'
DEBUG org.hibernate.type.StringType  - binding 'xyz uniq1206517288290%' to parameter: 1
DEBUG org.hibernate.type.IntegerType  - returning '16' as column: ID0_0_
DEBUG org.hibernate.type.StringType  - returning 'XyZ uniq1206517288290 blablabla' as column: text0_0_

Hibernate: select this_.ID as ID0_0_, this_.text as text0_0_ from test this_ where this_.text like ? escape '\'
DEBUG org.hibernate.type.StringType  - binding 'xyz uniq1206517288290%' to parameter: 1


> LikeExpression case sensitive not working properly
> --------------------------------------------------
>
>                 Key: HHH-2997
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2997
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: query-criteria
>    Affects Versions: 3.2.5
>         Environment: Hibernate 3.2.5
>            Reporter: Adam Czysciak
>            Priority: Minor
>         Attachments: hibernate2997test.zip, LikeExpression.patch, LikeExpression.patch
>
>
> LikeExpression doesn't handle ignoreCase flag properly when it's set to false. Uses it to build correct sql "property like ?", but doesn't use the flag inside getTypedValues - produces always lowercase value to bind.
> Attached a patch for 3.2.5

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list