Questions tagged [sqlresultsetmapping]
81 questions
0
votes
1 answer
Map result set to custom pojo which is not entity
I need to fetch 4 columns by joining multiple tables. I have created the query. But how can I map the result set to a pojo which is not an entity and i want to use Spring Data JPA.
Could someone please help?
Thank you!
EDIT
Custom POJO class:
` …

Pavan
- 217
- 1
- 4
- 12
0
votes
1 answer
hibernate native query complex constructor mapping
Java, Spring Data JPA
I have 2 entities:
class Source {
Integer id;
String name;
}
class Item {
Integer id;
String name;
Integer sourceId;
}
I need statistic native query result like this:
select s.id source_id, s.name source_name,…

Elegant.Obj
- 131
- 1
- 12
0
votes
1 answer
JPA SqlResultSetMapping object order
JPA: if classes, entities and columns are defined in @SqlResultSetMapping, what is the order of objects returned?
@SqlResultSetMapping(
name="CustomerDetailsResult",
classes={
@ConstructorResult(
…

eastwater
- 4,624
- 9
- 49
- 118
0
votes
0 answers
Spring's ResultsSetExtractor for SQL inner join statement
I'm trying to use ResultSetExtractor to send a SQL statement to the database, but the method is getting stuck at the line l.setId(resultSet.getInt("Id"));.
This is my error message:
"message": "PreparedStatementCallback; uncategorized SQLException…
0
votes
0 answers
Why cannot I use @SqlResultSetMapping with query cursor hint
In Eclipselink, when I use @SqlResultSetMappings and I use Query Hint eclipselink.cursor, the console shows me the following exception:
Caused By: java.lang.IllegalArgumentException: Query null, query hint eclipselink.cursor is not valid for this…

Fábio Almeida
- 276
- 3
- 11
0
votes
1 answer
class cast exception using SqlResultSetMapping and ConstructorResult
I'm trying to map the results of a NativeQuery to a non-entity pojo, using SqlResultSetMapping and ConstructorResult
I'm using this StreetCity class, with result mapping:
@Data
@SqlResultSetMapping(name = "StreetCityResult", classes = {
…

Jarl Wijman
- 53
- 7
0
votes
1 answer
Different result for @SQLResultSetMapping+Joins on multiple entities | JPA
I am running a NativeQuery with JPA that gives different results compared to running the query in an sql tool. Probably I missunderstand s.th. within the concept of @SQLResultSetMapping.
--- Overview ---
I am mapping the result to two entities, so I…

mararn1618
- 437
- 6
- 16
0
votes
1 answer
How to use @SqlResultSetMapping in Symfony2, doctrine 2?
There is an example about @SqlResultSetMapping in
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/native-sql.html
I do not understand where and how i should use it? In controller action? In some custom class or trait?

olga
- 959
- 1
- 15
- 42
0
votes
1 answer
SQL postgres - How to rename each column after join because their are too many fields
I want to join two tables and read all the columns within java. In java the resultset contains all the fields but they have the same names for both tables.
Their are about 65 columns and I do not want to specify each column after the select.
SQL…

ninjaxelite
- 1,139
- 2
- 20
- 43
0
votes
1 answer
Creating JSON properly from SQL Resultset using Java
I have a table as
Country State
USA Texas
USA Alasca
India Delhi
India Bombay
India Madras
Russia Mosco
Russia Petersberg
Germany Berlin
China Beijing
China …

Sajeev Zacharias
- 157
- 1
- 17
0
votes
1 answer
get sums for pivot results
@DateMonth as INT,
@DateYear as INT
AS
--set @DateMonth = 08
--SET @DateYear = 2015
DECLARE @FromDate DateTime;
DECLARE @ToDate DateTime;
SET @FromDate = CONVERT(DateTime, convert(varchar, @DateMonth) + '/01/' +…

FloatingPC
- 1
- 4
0
votes
0 answers
jpa native query control entity(part 2)
Cont. on jpa native query retrieve multiple entities
My database (testing)
company - ID {PK}, name
staff - ID{PK}, name, companyID{FK}
department - ID{PK}, name, companyID{FK}, staffID{FK}
project - ID{PK}, name, staffID{FK}
First, I want to…

KKL Michael
- 795
- 1
- 13
- 31
0
votes
1 answer
symfony2 / doctrine: how to use ResultSetMapping with count
I have an archive table (id, title, author) and a download_history table (id, id_archive, date) to keep track of how many download for each archive. Now I want to build a report to view the most downloaded archives on a weekly bases. Pretty simple…

user3174311
- 1,714
- 5
- 28
- 66
0
votes
1 answer
How to return multiple results in a unique mapped or not object JPA
org.hibernate
hibernate-core
4.3.8.Final
org.hibernate
hibernate-entitymanager
4.3.8.Final
My…

user2824425
- 15
- 5
0
votes
1 answer
Using JPA 2.1, how do I map a native query result to a @Transient field taht is a Set?
I’m using JPA 2.1, Hibernate 4.1.3.Final, and MySQL 5.5.37. How do I map a result set to a @Transient collection? In my entity, I have set up
@Entity
@Table(name = "category", uniqueConstraints = { @UniqueConstraint(columnNames = { "NAME",…

Dave
- 15,639
- 133
- 442
- 830