Database independent string comparison with JPA

后端 未结 3 2015
攒了一身酷
攒了一身酷 2021-01-19 04:17

I\'m working with JPA (Hibernate as provider) and an underlying MySQL database.

I have a table containing every name of streets in Germany. Every streetname has a un

3条回答
  •  攒了一身酷
    2021-01-19 05:02

    To stay "independant" as you say for database and JPA provider i would avoid the getSingleResult() and fetch the list() and match in memory for the name. Probably you will get more than one but not 100 or more.

    Another way could be to save the name normalised (trimmed, to lower case) in a new field.

提交回复
热议问题