简体   繁体   中英

how to index columns for case-insensitive search using Hibernate Criteria on different databases

I am using hibernate and have already in place a search by criteria that is case-insensitive. However the search performance is lacking. I do not know how to set up the configuration so that is works on Oracle as well as on Sql-Server. Because

  • case-insensitive columns are only supported by Sql-Server
  • function based indexes are only supported by Oracle

There is the option of creating a new column for case-insensitive search, but then I would have to adjust all my bindings or is there another way?

I think the word you are searching for is "collation".

Usually collation is specified at the database, column or query level, and possibly also at index level.

I don't think there is an implementation of specifying collation at query level in Hibernate.

You might use native queries where you might be able to use database specific functions like COLLATE in SQLServer or COLLATE in Oracle to cast the collation for a given expression.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM