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…
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…
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
{
/**
*…
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.…
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 =…
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"…
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…
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…
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 =…
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…
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,…
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…
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…
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…
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…