Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

284
Visualizações
Consulta nativa que no funciona en hibernación

Tengo un problema con mi consulta nativa.

Tengo:

 @Query(value="SELECT * from orders where orders.house in ((:houseArray))", nativeQuery = true) List<Order> findByHouseId(@Param("houseArray") List<Long> houseArray);

Y cuando estoy tratando de ejecutar, obtengo lo siguiente:

 2017-04-18 14:19:49,736 DEBUG org.hibernate.SQL: SELECT * from orders where orders.house in ((?, ?, ?, ?, ?)) 2017-04-18 14:19:49,737 TRACE ohtdsBasicBinder: binding parameter [2] as [BIGINT] - [4] 2017-04-18 14:19:49,737 TRACE ohtdsBasicBinder: binding parameter [3] as [BIGINT] - [5] 2017-04-18 14:19:49,737 TRACE ohtdsBasicBinder: binding parameter [1] as [BIGINT] - [3] 2017-04-18 14:19:49,737 TRACE ohtdsBasicBinder: binding parameter [4] as [BIGINT] - [6] 2017-04-18 14:19:49,737 TRACE ohtdsBasicBinder: binding parameter [5] as [BIGINT] - [7] 2017-04-18 14:19:49,738 ERROR ohejsSqlExceptionHelper: ERROR: operator does not exist: bigint = record Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts. Position: 49 2017-04-18 14:19:49,756 ERROR oaccC[.[.[.[dispatcherServlet]: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet] with root cause org.postgresql.util.PSQLException: ERROR: operator does not exist: bigint = record Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.

Sin embargo, si ejecuto la siguiente consulta en la consola:

 SELECT * from orders where orders.house in (1,15,2,4,5,3,6,7);

Devuelve la lista adecuada de pedidos.

¿Cómo puedo arreglar esto?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Intente eliminar un conjunto de corchetes de ((:houseArray)) para que se vea así:

 @Query(value="SELECT * from orders where orders.house in (:houseArray)", nativeQuery = true) List<Order> findByHouseId(@Param("houseArray") List<Long> houseArray);

(value, value, value) es un registro, por lo que cuando haces una column in ((value, value, value)) comparas la columna con el registro.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda