Questions tagged [nativequery]

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

Related links

355 questions
1
vote
1 answer

Scan Native query in JPA using SonarQube

I have native queries in java files and i want to scan that queries for using sonarQube server. Is there any way to do that?
SahilPatel
  • 362
  • 3
  • 17
1
vote
0 answers

Java.util.UUID is saving as BLOB in Mysql DB

public class Test{ @Id @JsonIgnore @GeneratedValue(generator = "uuid2") @GenericGenerator(name = "uuid2", strategy = "uuid2") @Column(name="TEST_ID",columnDefinition = "BINARY(16)") @Type(type="uuid-binary") …
Veds
  • 11
  • 1
  • 6
1
vote
1 answer

Use native query to "create table" in a jta transaction can't be rolled back?

I'm using entity manager to create a table with native query,and insert rows to another table with em.persist(). when the native query which is create table failed,I rolled back,but the em.persist() is always successful.Does anyone know the answer??…
Jianspf
  • 11
  • 4
1
vote
1 answer

NativeQuery with OpenQuery and Parameters

I've been triyng to create a query using a dblink with some parameters. I'm using Hibernate 4 and the database is a MSSQL. But I either get: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '@P0'. if my query is…
Batousay
  • 21
  • 4
1
vote
1 answer

invalid column name error while using JPA nativequery in netweaver server with Oracle 10g database

I'm getting invalid column name error while using JPA nativequery in netweaver server .The database is Oracle 10g here is my code Query query = em.createNativeQuery("select et.eqt_desc from ge_equip_type et",GeEquipType.class); final List
sab
  • 13
  • 5
1
vote
1 answer

Java native SQL query to display all values when an input param is null

I have the following DAO method: public String getSomeTable(final String param1) { String sqlString = "select * from table where name ilike ?"; Query query = this.getEntityManager().createNativeQuery(sqlString); query.setParameter(1,…
Hexy
  • 828
  • 14
  • 24
1
vote
0 answers

Reusing fields for JPA entities in native query

We use JPA in our project but there are certain complex queries that need to be done straightforward in native query. We make use JPA native queries for this, like the one below Query query = em.createNativeQuery(sql.toString(),…
1
vote
2 answers

How to use the Postgres any-clause with JPA/Hibernate native queries (array parameters)

So we've got a whole lot of Postgres SQL queries stored in files and used from PHP. The task is to replace PHP with Java. We want to reuse as much of the queries "as is" to keep the migration path short. I can't get the Array parameters to…
Brixomatic
  • 381
  • 4
  • 16
1
vote
1 answer

Map SQL query with multiple repetitions to hibernate entity

I have a result set that is returned from a pretty complex query which I would prefer to run using SQL rather than HQL. Just for context - It is a suggestions result set that suggest replacing existing objects that the customer pays for, to another…
Avi
  • 21,182
  • 26
  • 82
  • 121
1
vote
1 answer

How to have named native queries for 2 (or more) database using JPA and EclipseLink

How to have named native queries for 2 databases and have the EclipseLink run the right one on the db? I give an example: I have a solution that can run with Oracle Db and PostgreSQL. There is a need for native queries to be run on db. So the native…
Ali
  • 899
  • 2
  • 13
  • 33
1
vote
1 answer

NativeQuery is better or HibernateOGM methods

I am using hibernate OGM to talk to my MongoDB instance. I had to get a list of all the products with category "abc". I am using the native query approach to achieve this as following: String stringQuery = "db.Message.find({'CATEGORY':'" + category…
1
vote
0 answers

How to retrieve data from nativeQuery which have data from multiple entities

I have query which returns data from multiple entities @Override public List testPlayerQuerry() { return copyTest(em.createNativeQuery("select player_name, pg.player_game_score, g.game_description from player p\n" +…
user5717294
1
vote
1 answer

Retrieving data from native query and conversion

I have following query @Override public List testPlayerQuerry() { return copyPlayersToDetails(em.createNativeQuery("select player_name from player p\n" + "join Player_Game pg on p.player_id = pg.fk_player_id\n" …
user5717294
1
vote
0 answers

Spring Data JPA - nativequery, param values replace

Using Spring data JPA, trying to create a generic method to upload csv data to database using Load Data mysql. The below code is my attempt. The problem is, the second parameter tablename is getting replaced with quotes. Eg: LOAD DATA LOCAL INFILE…
Naren Kannan
  • 21
  • 1
  • 6
1
vote
0 answers

NativeQuery to queryBuilder impossible but i need querybuilder for my form entity type

I have a sql query too complex to translate in QueryBuilder. It works by nativequery. The problem is that my entity type asks me a QueryBuilder not a query. Do you have a solution? This is my query : SELECT v.* FROM vat_rates v INNER JOIN ( …