sql - how to use ignore case in spring JPA @query? -
i have query below:
@query("select b brand b b.name1 %:name1% or b.name2 %:name2%") list<brand> findsome(@param("name1") string name1, @param("name2") string name2);
i want ignore case tried modified it
@query("select b brand b lower(b.name1) lower(%:name1%) or lower(b.name2) lower(%:name2%)")
but looks don't work, how can do?
the problem syntax of jp-query. try use this:
lower(b.name1) concat('%', lower(:name1), '%')
further reference: http://openjpa.apache.org/builds/1.2.3/apache-openjpa/docs/jpa_langref.html#jpa_langref_like
Comments
Post a Comment