Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

130
Vistas
Spring @Query with Lower and Wildcards

This Question refers to Spring Data JPA.

I need a (native) @Query with the Lower Function and Wildcards. But I dont get it to work.

Here is a oversimplified version of what I am looking for:

@Query(value = "SELECT * FROM CAR c WHERE LOWER(c.model) LIKE LOWER(%:model%)", nativeQuery = true)
List<Car> findByModelMatching( @Param("model") String model );

LOWER(%:model%) -> not working! LOWER(:model) -> works!

I am aware of that such a query can be easily re-written as:

List<Car> findByModelContainingIgnoreCase( String model );

But I am not looking for a Named Query.

My Question is: How to combine LOWER (or even UPPER) with WildCards in a @Query!

Cheers

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The LOWER function accepts strings, you should write LOWER('%' || :model || '%') if you are on Oracle for example.

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda