Questions tagged [nativequery]

JPA concept that allows queries in your native database syntax (instead of JPQL)

Related links

355 questions
0
votes
0 answers

Mysql 8 @Enumerated(EnumType.STRING) java enum hibernate native query param problem upgrade from mysql 5.7

I have an issue with @Enumerated(EnumType.STRING) enum passed as param to native query after mysql upgrade from 5.7 to 8.0.34. My simplified setup: public enum MyEnum { A,B; } @Entity @Audited @Table(name = "my_table") …
ArturM
  • 1
0
votes
0 answers

A TupleBackedMap cannot be modified

I have API get data from 3 table I use native query in Spring Boot and database MySQL: @Query(value = "SELECT stock.product_id as productId,two.product_name as productName, two.brand as brand, two.description as description, two.categoryid as…
LITTE_BOY
  • 1
  • 2
  • 2
0
votes
0 answers

Using Native SQL Queries with Latest Hibernate Version (Post-5.2) - Deprecated Legacy-Style Parameters Issue

'm currently working on a project that utilizes Hibernate as the ORM tool, and we have recently updated to the latest version of Hibernate (post-5.2). In our codebase, we have been using native SQL queries with the createSQLQuery method, which…
0
votes
0 answers

I have to fetch the number of order requests arrived in last 2 hours in a sql server table: ORDER_REQUEST group by order origin id using data_jpa

I have to fetch the number of order requests arrived in last 2 hours in a sql server table: ORDER_REQUEST group by order origin id using data_jpa. I have tried various ways to achieve this using native query in data jpa but getting some…
0
votes
2 answers

Saving enum name in native query

Is it possible with the entity manager to save the name of the enum without using the name method? I need it because sometimes my enum will be null and then the name method would return a nullpointer. Now I have to do…
pawello12
  • 17
  • 5
0
votes
3 answers

how to bind null value in native query in spring

@Query(value = "SELECT TRUNC(p.CREATION_DATE), SUM(p.AMOUNT)" + " FROM PAYMENT p" + " INNER JOIN FACTOR f" + " ON p.PAYMENT_ID = f.FACTOR_ID" + " JOIN VEHICLE_GATEWAY v" + " ON v.FACTOR_ID…
masoome
  • 27
  • 5
0
votes
0 answers

Spring Boot - Entity Manager - Native query for handling jsonb operators

I am using spring boot and jpa to execute native queries. One of my column is jsonb and I need to use json operator "?|" which tries to see if any value exist in array. It fails with "ordinal parameter not bound: 1" This is what I am trying to…
0
votes
0 answers

Java Spring query with Oracle

I'm facing a problem where I got "oracle.jdbc.OracleDatabaseException: ORA-01722: invalid number" while trying to run query in my console, in the other hand I got the exact number that I want when I run it in DBeaver. Here's my…
0
votes
2 answers

Does Hibernate CreateNativeQuery allow JSON cast?

Using Java and Hibernate 6.1.7 Final: Is it possible to use a JSON key in the select statement when using createNativeQuery()? Example: Query query = new SessionManager().fetch() .createNativeQuery( "select contactid,…
0
votes
0 answers

issue setting parameter to nativeQuery of an entityManager

I use an EntityManager to create a nativeQuery. My database is a Oracle database. In this query: public Map ricavaDoppioniDiUnaTabellaNSNBroker(String database, String tabella, String colonna) throws PersistenceException { …
0
votes
0 answers

JPA Native Query doesn't seem to support PostgreSQL ARRAY function

My query is: SELECT id FROM person WHERE authority_right = ARRAY[1,2] authority_right is integer array. My goal is to find people who have authority_right exactly equal to [1,2], not [1] and not [2]. This query is executed successfully in console,…
stakeika
  • 55
  • 1
  • 8
0
votes
0 answers

Spring Data JPA + Native Query Interface based Projection + returns UnsupportedOperationException : No matching converter found

I recently upgraded spring boot to version 3.0.4. After that I started to get "[java.lang.UnsupportedOperationException: Cannot project java.lang.Boolean to java.lang.Number; Target type is not an interface and no matching Converter found]" when I…
Karul
  • 1
  • 1
0
votes
0 answers

Truncating table in Spring using native query For MySQL throws exception during startup

@Repository public interface CarRepository extends JpaRepository { @Modifying @Transactional @Query(value = "truncate table car", nativeQuery = true) void truncateCarTable(); } When I added the method I get the following…
0
votes
0 answers

Spring - Pagination with spring data and native complex query

I am having a query that uses a declare statement before executing the actual query. As I am using MSSQL server. So, my query is like the the below: DECLARE @IdParam NVARCHAR(50) = ( SELECT TOP 1 PartyID FROM PartyInfo WHERE PartyName = ?1 ORDER BY…
0
votes
1 answer

The column name id was not found in this ResultSet.[] : "spring boot native query error"

When I am executing the below query in Dbeaver I am getting the correct result WITH A_ID AS (SELECT ROR.ID FROM RECORD_ORDER ROR WHERE ROR.order_no = '123' UNION SELECT RL.record_key FROM RECORD_LINE RL where RL.line_no = '077') SELECT RO FROM…