Questions tagged [sqlresultsetmapping]
81 questions
1
vote
0 answers
JPA SQLResultSetMapping for SQL Aliases not Working At All?
Native SQL with aliased field names + remapping to receive managed entities is required for more complex queries with joined tables.
However, the mapping of the SQL aliases leads to an exception where the aliased fields cannot be found. Can anybody…

HeinMel
- 11
- 2
1
vote
3 answers
SQL Query Buffer in result - Show one by one
I have a sql script as follow :
declare db_list cursor for
select name From sys.databases
open db_list
declare @var varchar(MAX)
fetch next from db_list into @var
print @var
while (@@FETCH_STATUS = 0)
BEGIN
EXEC('use '+@var)
…

Sumit Singh
- 93
- 1
- 10
1
vote
1 answer
Join two entities in a non entity class
I want to join two entities in a non-entity class, which will have the two entities as attributes of the class.
Take this as example:
@Entity
public class A {
}
@Entity
public class B {
}
public class C {
private A a;
private B b;
}
I…

Alex Chihaia
- 103
- 2
- 15
1
vote
1 answer
@SqlResultSetMapping @ConstructorResult @ColumnResult doesn't work for java.time.LocalDate
I have a simple entity
@Entity
@NamedNativeQueries({
@NamedNativeQuery(name = "Account.dailyRegistered",
query = "select date(date_trunc('day', creation_date)) as period, count(1) as metric"
+ " from account "
…

Andrey Beletsky
- 97
- 1
- 2
- 7
1
vote
1 answer
Call stored procedure using JPA 2.1 and do Sql Result SetMapping to Pojo
I am trying to call a stored procedure which returns a non entity object using JPA. Here is what I do.
StoredProcedureQuery query = entityManager.createStoredProcedureQuery(
"DepAndTerm",…

fjkjava
- 1,414
- 1
- 19
- 24
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
1 answer
How to Map Result Set of Native Query to Variable in Entity
I have two entities, Users and Annotations, and I want to add a set of results from a query on the Annotations table to a transient variable in the Users entity.
Entities:
Users
@Entity
public class Users {
@Id
@GeneratedValue
…

mrks_
- 359
- 4
- 20
1
vote
0 answers
java jpa sqlResultSetMapping
This is my first time to learn the SqlResultSetMapping.
My database structure:
table 'Company':
ID Name
1 ABC Sdn Bhd
2 DEF Sdn Bhd
3 GHI Sdn Bhd
table 'Staff':
staffID staffName companyID
0001 Ali 1
0002 Abu 2
0003 …

KKL Michael
- 795
- 1
- 13
- 31
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
{
/**
*…

VaN
- 2,180
- 4
- 19
- 43
1
vote
0 answers
Hibernate, SQL server and @SqlResultSetMapping with native query
I'm working with a very old database and I've to retrieve some specific data.
I use sql server and hibernate. I've written a class named Language with a guid (id of a person) and a set known languages. I've to retrieve all languages known by each…

Maverik
- 179
- 1
- 1
- 9
1
vote
1 answer
Doctrine2 - select from multiple tables with no direct relations
This question is about selecting data from multiple tables, joins, Doctrine2, ResultSetMapping, DQL and such stuff.
I have 4 tables:
user
contact
contact_phone
call
With relations as shown on the image: https://i.stack.imgur.com/762Jw.png
Every…

socket
- 11
- 1
- 2
1
vote
2 answers
Displaying Object List From Class In Jsp
I am using Spring MVC and i implemented ResultSetExtractor since one of my classes had a complex list object. I did the mappings and then made the select from the database. I am having problems displaying the data from the list items in the…

devdar
- 5,564
- 28
- 100
- 153
1
vote
1 answer
Doctrine 2.0 Resultset Mapping is used incorrectly?
I'm having a problem with Doctrine's ResultSetMapping when trying to do a native query.
$sql = "SELECT id, thesis "
. "FROM activity p "
. "WHERE MATCH (thesis) AGAINST ('Gun') ";
$rsm = new…

NightRaven
- 401
- 3
- 17
0
votes
1 answer
@NamedNativeQuery and @SqlResultSetMapping: No converter found capable of converting from type [$TupleConverter$TupleBackedMap]
I am getting the following stacktrace:
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to…

Clem
- 1
0
votes
0 answers
Use @SqlResultSetMapping to map entity that has a @OneToMany association with a non-PK referencedColumnName
I am trying to use a @SqlResultSetMapping to map a native-query-result into an Entity.
This entity happens to have a lazy loaded @OneToMany with a referencedColumnName that does not point to a PK. That @OneToMany is not relevant to my native…

M364M4N cro
- 680
- 2
- 10
- 23