Questions tagged [native-sql]
77 questions
1
vote
0 answers
ConverterNotFoundException only in Testing time
I have java spring (v2.7.1) application and I want to test my database (H2 DB) layer.
I have the following query:
@Query(value =
"SELECT something.c1 " +
"FROM " +
"(SELECT Count(c1) AS Count, c1 " +
"FROM…

HowToTellAChild
- 623
- 1
- 9
- 21
1
vote
1 answer
Is it possible for unit test cases for Spring boot data jpa @Query native queries?
I have a spring boot application with JPA configured. While querying the database i am running native sql query with the help of spring data @query annotation. Now i am planning to write test cases using spring boot test framework. Is it possible to…

Guraraj
- 13
- 6
1
vote
1 answer
createQuery vs createNativeQuery, performance difference for update/delete statements
Is there a performance difference between:
entityManager.createQuery("UPDATE MyTable SET coll1 = :someValue").setParameter("someValue").executeUpdate();
and
entityManager.createNativeQuery("UPDATE MyTable SET coll1 =…

M364M4N cro
- 680
- 2
- 10
- 23
1
vote
0 answers
Native SQL + Hibernate Multitenant
I explain my situation: SpringBoot + Hibernate + Multitenant (DB master + DB for tenant) + Postgressql. I have two datasource configurations, one for the master and one for each client's database.
My problem starts when I need to make a native…

Tecnologia Kretz
- 51
- 7
1
vote
0 answers
Does Hibernate using preparedStatement internally when native update query?
I have a question.
Does the JPA(Hibernate) use a preparedStatement internally when using native update query?
Query query = EntityManager.createNativeQuery(updateSql);
//... some other codes here
query.setParameter(1,…

Yonghee Lee
- 11
- 3
1
vote
1 answer
Not getting results in Hibernate native query using WITH Clause
I have a following query which starts with "WITH" clause. And If I fire same query in SQuirrel which is having DB2 connection - It works. But same query returns blank array in Hibernate Native SQL.
WITH edd_translated_article_tmp (article_id,…

Harsh Goswami
- 502
- 3
- 12
1
vote
1 answer
JPA native sql query mapping error?
I have a JPA entity MyEntity which includes a composite primary key in a @Embeddable class MyEntityPK.
I am using a native sql query in method getThreeColumnsFromMyEntity():
public List getThreeColumnsFromMyEntity() {
List…

Bonzay
- 740
- 2
- 10
- 29
1
vote
1 answer
Symfony & Doctrine : DQL Max() with groupBy
I'm working on Symfony 3.2 and i'm trying to do a "simple" Query.
This is the SQL version of the query that works (tested directly in PHPmyAdmin)
SELECT s.*
FROM pl_statsheet s
INNER JOIN (
SELECT day, MAX(points) AS points
FROM pl_statsheet
GROUP…

fly LFC
- 101
- 1
- 1
- 5
1
vote
2 answers
ABAP: using SQL Server table hints in a Native SQL block
I have an ABAP class with various methods for reading from / writing to a remote Microsoft SQL Server 2005 instance.
Everything works as expected. Now I've been advised to add a SQL Server table hint (READPAST) to a SELECT query, for safety reasons…

MacThePenguin
- 128
- 4
1
vote
1 answer
Symfony2 Error: Object of class Doctrine\ORM\EntityManager could not be converted to string
I have 2 non related entities: External and Internal. I need to union select all results from entities. I am using ResultSetMapping and Native SQL to do this:
$em = $this->getDoctrine()
->getManager()->getConnection();
$rsm = new…

user3793667
- 321
- 1
- 6
- 18
1
vote
3 answers
Select n number of records from oracle database
I have to select n number of rows from an oracle database from sap using native sql. In open sql the query would be like
select * from myDB where size > 2000 upto n rows.
what I learnt from other posts the equivalent native sql query would be…

Kushal Chowdhury
- 11
- 1
- 2
1
vote
1 answer
Native sql using entity framework without entity class
I have a native sql query which changes dynamically based on user selection.
Code
var sql = "select * from " + temp + ";";
var templist = db.Database.SqlQuery<>(sql).ToList();
The temp variable contains table name which is obtained based on user…

Vikas Sawant
- 43
- 1
- 10
1
vote
1 answer
QueryDSL: How to apply type mappings via the querydsl-maven-plugin
I've run into a problem concerning the mapping of DB column types to JAVA types in the generated metadata classes generated from the querydsl-maven-plugin.
We have a Oracle DB column with the following definition
priority number(1,0) not null…

M. Lindenmann
- 81
- 1
- 2
- 6
1
vote
2 answers
Retrieving a value from Stored Procedure using Native SQL Hibernate
Below is the stored procedure:
create or replace procedure
proc_emp_name(v_emp out emp.emp_name%TYPE, v_empid in emp.emp_id%TYPE)
is
begin
select emp_name into v_emp from emp where emp_id = v_empid;
dbms_output.put_line('Emp Name: ' ||…

user182944
- 7,897
- 33
- 108
- 174
1
vote
1 answer
Hibernate Native SQL
While i am executing the following Native sql hibernate application , i am getting java.sql.SQLException: Invalid column name .
I am using Oracle 11g . Also i have Employee table with these following columns.
Code
this is the mapping file .