Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PostgresSQL
- Note : Enable unaccent extension in your database :
- CREATE EXTENSION unaccent;
- @Query(nativeQuery = true, value = "SELECT * FROM schema_name.table_name "
- + "WHERE unaccent(col_name) = unaccent(:name)")
- public List<EntityName> find(@Param("name") String name);
- MySQL
- For those who use MySQL you can use collate utf8_bin Like this :
- @Query(nativeQuery = true, value = "SELECT * FROM table_name "
- + "WHERE col_name = :name collate utf8_bin")
- public List<EntityName> find(@Param("name") String name);
- SQL Server
- For those who are using Oracle you can use collation
- @Query(nativeQuery = true, value = "SELECT * FROM table_name WHERE "
- + "name COLLATE Latin1_general_CI_AI Like :name COLLATE Latin1_general_CI_AI")
- public List<EntityName> find(@Param("name") String name);
- References :
- Does PostgreSQL support "accent insensitive" collations?
- How do I perform an accent insensitive compare (e with è, é, ê and ë) in SQL Server?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement