Questions tagged [nativequery]

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

Related links

355 questions
1
vote
1 answer

Trying to use SQL Function in hibernate

I am trying to call My-SQL function which is returning calculated value based on input parameters. I am using native queries for this purpose, I am able to get all fields except calculated field. I am always getting NULL as value for calculated…
Shirish Bathe
  • 627
  • 9
  • 22
1
vote
1 answer

JPA Custom @Query for counting !boolean

I am doing a lot of arithmetic and joins in my actual Query, all of which are working fine. I have the following (Simplified version for the purpose of this question) working custom query, where i am counting the number of instances with 'isSuccess…
ZOXIS
  • 578
  • 5
  • 15
1
vote
0 answers

How to exclude bidirectionnal relations using NativeQuery and ResultSetMapping?

I have 2 entities, User and Customer, with a OneToOne bi-directionnal relation. User entity also have a bi-directionnal relation with Invoice entity : class User implements UserInterface { /** *…
1
vote
1 answer

Writing JPA query from a Native Query

I want to write a JPA query from a native query. The Native query is as follows: select alias.fname from (select name, fname, lname from student) alias where student_id='1'; I am unable to create a JPA query from this, any help is appreciated.…
Nelson
  • 13
  • 5
1
vote
0 answers

JPA native query with mariadb and SqlResultSetMapping throwing a weird error

The relationship: A company has an address. Thats all I am testing for this simple example. This is the address entity with the SqlResultSetMappings. @Entity @Table(name="addresses") @SqlResultSetMappings({ @SqlResultSetMapping(name =…
sat
  • 5,489
  • 10
  • 63
  • 81
1
vote
2 answers

Exception in thread "main" java.lang.UnsupportedOperationException

I am trying to get an ordered list of vehicles using Native Query in Java. I am using two methods, the first to get the vehicles, and the second method to order the list. I get this error: Exception in thread "main"…
user3325719
  • 75
  • 4
  • 14
1
vote
1 answer

How to write SQL query using Doctrine 2's NativeQuery with joins?

I want to write a query that involves the use of 'UNION' (which is not supported by DQL) therefore I am trying to write a MySQL query using Doctrine 2's NativeQuery. I have been using Doctrine's documentation. So far my code consists of: $rsm = new…
Mr B
  • 3,980
  • 9
  • 48
  • 74
1
vote
1 answer

Get Alias using ResultSetMapping

I have a query that using latitude and longitude, gets me the records that are close to other latitude and longitude. In the query I get the distance but I don't know how to return it. This is my code: public function findNearUsers($lon, $lat, $dist…
raygo
  • 1,348
  • 5
  • 18
  • 40
1
vote
1 answer

Mixing Native SQL with Default Hibernate Behavior in an Entity Object?

I'm trying to work a native sql query into an existing entity object while retaining the default Hibernate behavior for the object as a whole. The majority of the fields on the object are mapped as so: @Column(name = "FIRST_NAME", nullable =…
JPittard
  • 645
  • 1
  • 5
  • 6
1
vote
1 answer

Reset Doctrine ResultSetMapping for subsequent query

I'm using Doctrine2 in Zend Framework 2. In a very unique case, I need to create a native SQL query which only selects a table's id and does some geographic calculations. I followed the documentation and created a ResultSetMapping definition for…
John F
  • 865
  • 1
  • 8
  • 15
1
vote
1 answer

After execution of native update query still old value in retrieved entity

I'm using a native query for updating a value of a certain key in a HashMap annotated with @ElementCollection. After the query is executed the complete entity that contains the HashMap will be retrivied with EntityManager.find(...). The problem is,…
user1056903
  • 921
  • 9
  • 26
1
vote
2 answers

"Wrong number or types of arguments" in nativeQuery with temporal parameter set to null

Given the following Oracle SQL stored procedure signature: PROCEDURE Update_Desactivation_Date( code_util IN NUMBER, t_no_piste IN VARCHAR2, date_depart IN DATE); Called from a Java JPA2 Hibernate…
Mithfindel
  • 4,553
  • 1
  • 23
  • 32
1
vote
2 answers

Eclipselink mongoDB native query find() not working

I am recenttly working on a JAVA project with a mongoDB database. Being so i decided to use eclipselink 2.4. Regarding queries, it allows the usual "SQL like" queries but also (supposedly) allows native mongoDB queries. I followed this tutorial and…
lage
  • 589
  • 2
  • 5
  • 18
0
votes
1 answer

Passing user defined TABLE type to stored Oracle function

I have an oracle function defined as: FUNCTION SELECTINBOX (FA_FROMUSERLIKE IN PKGSMSTYPES.MAXVARCHAR2_T DEFAULT NULL , FA_INBOXOWNER IN PKGSMSTYPES.MAXVARCHAR2_T, FA_A_URGENCY IN G_INTARRAY_TBL DEFAULT NULL , FA_PAGENO IN…
iahsan
  • 115
  • 8
0
votes
0 answers

Delete query workaround in DB

At present the DB look like this: item club 2 10 2 20 2 30 3 30 3 40 3 60 4 30 4 40 4 60 I want to delete club 10 of item 2 and club (30,40) of item 3. For that I am using this query DELETE from allocation.testDelete…
PAMPA ROY
  • 25
  • 5