Questions tagged [sqlresultsetmapping]

81 questions
3
votes
1 answer

ParameterizedRowMapper That Maps Object List to Object

I am trying to set the Parent List in a ParameterizedRowMapper how is this written or approached. I have two Objects one for parent and one for children however children contains a ListThe parents for each child are stored in a separate table in the…
devdar
  • 5,564
  • 28
  • 100
  • 153
3
votes
2 answers

Reading from multiple tables and populating multiple entities using JPA SqlResultSetMapping

I have been building a JSF application using JPA to access the DB. There are a number of entities. I want to create a search results screen that shows columns from more than one entity in a table. These entities do not have foreign key…
Steve Claridge
  • 10,650
  • 8
  • 33
  • 35
2
votes
3 answers

Java JPA Hibernate SqlResultSetMapping Aliases

In Java application which uses JPA 2.1 with Hibernate 4.3.11 implementation I am trying to use SqlResultSetMapping to map native query results to entity. Query includes joined two tables with same column names, so I need to use aliases and map them…
Miha
  • 45
  • 1
  • 6
2
votes
1 answer

Open JPA ResultSet mapping

I have an entity called order which contains 10 columns and also has embedded id(composite key) columns which contains 5 fields in entity order. Here is my sql query
2
votes
2 answers

JPA 2.1 error : No @NamedStoredProcedureQuery was found with that name :

I tried to get the data from the postgresSql function, I used this example here Below the mapping class with IN/OUT data: @XmlType(name="AccountRR") @NamedStoredProcedureQuery ( name="getAccountMapping", procedureName="accountFunction", …
sanfrareau
  • 113
  • 2
  • 12
2
votes
1 answer

JPA 2.1 ConstructorResult Causing ClassCastException

The objects in my resultset are being cast to 'Object' instead of what I specified in the @SQLResultSetMapping objects. I'm trying to get a handle on ConstructorResult and have created a query which contains a simple join and am trying to get the…
Bill Rosmus
  • 2,941
  • 7
  • 40
  • 61
2
votes
0 answers

JDBI ResultSetMapper: partially map row to a Class

When we define Mapper for a class, we have to fetch every column in sql queries in order to map with the Class in jdbc resultsetmapper eg. public class Mapper implements ResultSetMapper{ public MyClass map(int index, ResultSet rs,…
Dheerendra
  • 1,488
  • 5
  • 19
  • 36
2
votes
1 answer

How to get an associative array from a ResultSetMapping?

I'm working on a Symfony2 project (Doctrine) and I would like to get a simple associative array from a ResultSetMapping object. This is my request : $rsm = new ResultSetMapping; //$rsm->addIndexByScalar('name'); $rsm->addScalarResult('name',…
2
votes
1 answer

Doctrine2 Native Query: Rows are shifted

I want to use Doctrine result mapping, but I get a very strange result. This is my code in the repository "Result": $sql = 'SELECT * FROM ( SELECT k.id AS keyword_id, k.name, …
user1731323
  • 85
  • 1
  • 8
1
vote
1 answer

Unknown SqlResultSetMapping

I've been sitting here for long to solve this problem. (I can't show a lot of code because it is corporate secret so here will be parts of it or just examples) I have my project connected to 2 databases, with DataSource Let's say I have database…
bnemos
  • 11
  • 2
1
vote
0 answers

how to bind result of native query in data jpa to an entity with a @transient field

I work on a spring boot, data jpa web application and have a problem with an entity that has a @transient field and I want to bind result of my native query to this entity (all fields even @transient field) suppose Chat entity class in brief : …
1
vote
0 answers

Resultset Mapping Returns null, SQL statement doesn't

I have an SQL statement like this: SELECT generatedresult,sum(size) as count FROM table1_detail AS w WHERE date > '2011.06.01' AND w.l_date < '2011.06.02' GROUP BY category ORDER BY count desc ; Which returns: generatedresult | count …
lamostreta
  • 2,359
  • 7
  • 44
  • 61
1
vote
1 answer

JPA: @SqlResultSetMapping gives me two objects, not one

I am trying to do some NativeQueries, but I am stuck with @SqlResultSetMapping configuration. I have these classes: @Entity public class LocalUser implements Serializable { private static final long serialVersionUID = 1265845L; @Id …
Lukas Kosina
  • 11
  • 1
  • 3
1
vote
0 answers

Mapping different native queries result to same POJO with same SqlResultSetMapping?

I need to execute several different queries and I want to use the same POJO to get the results. What I get with those queries are combinations of same columns, can I reuse the same sqlResultSetMapping? I am working with JPA-2.1 and Java 8 My…
1
vote
1 answer

Mapping an SQL native query to a POJO class

I tried to map a native SQL query to a POJO class using @ConstructorResult of @SqlResultSetMapping as following : @SqlResultSetMapping( name = "AnomalieMapping", classes = @ConstructorResult( targetClass =…
Renaud is Not Bill Gates
  • 1,684
  • 34
  • 105
  • 191