Questions tagged [sqlresultsetmapping]

81 questions
0
votes
1 answer

How to Dynamically Retrieve JDBC ResultSet Data

The requirement is :- The application will run dynamic SQLs and show the results in table format in JSP. The SQL passed to the application will change, which means the number, name, datatype of selected columns will change and so the result set will…
0
votes
0 answers

Spring Data JPA NamedNativeQuery with SqlResultSetMapping and externalized query

I have a situation where I am making a read request to a database with a long, complex query that needs to map to a complex object. Based on my research, it looks like I want to use @SqlResultSetMapping to handle the mapping, but I would like to put…
0
votes
2 answers

Hibernate is not initialising nested entities when using NamedNativeQuery

The challenge: I am trying to batch fetch a collection of nested entities from my database. The resulting dataset ranges in the thousands of entities so my approach is to fetch entities in a paged fashion based on this post. The data is fetched from…
Aage Dahl
  • 1
  • 1
0
votes
0 answers

JDBC ResultSet - Many To Many

Greeting to all, As I'm learning Java, JDBC and MySQL I reach one point where I would like to perform the following I have 2 entites class User { private Long id; private String username; ... ... private Set teams; Constructors…
0
votes
1 answer

Doctrine ResultSetMapping(Builder) is not showing any results

My normal query was looking like this. $qb = $placeRepository->createQueryBuilder('p'); var_dump($qb->getQuery()->getResult()); I'll get few results as objects. So this is the normal behaviour. Then I want to add a custom field with…
Patrick
  • 829
  • 2
  • 13
  • 34
0
votes
1 answer

@SqlResultSetMapping binding inner class to targetclass

In my project, I have created a view that contains multiple joins. The following is part of the query from the view. a.id, b.object1, b.object2, b.object3, case when (c.type = 'qrt' then c.object4 else b.object4) end object4, case when(c.type =…
0
votes
0 answers

Calling Stored Procedure and mapping the query result to non-entity POJO using Spring JPA SqlResultSetMapping

I am attempting to map the results of a Stored procedure to a non-entity POJO using @SqlResultSetMapping with @ConstructorResult. Here is my code: @MappedSuperclass @SqlResultSetMapping(name = "Testing", classes = @ConstructorResult(targetClass =…
blackbird
  • 460
  • 3
  • 9
  • 25
0
votes
0 answers

java jpa SqlResultSetMapping issue

I have a table form_header with 3 records There are more fields in the table decided not to add it here in the post since most are irrelevant. I created a class/entity to get the count with distinct for each status in sql. @Entity() @Table(name =…
0
votes
1 answer

How to get only the value from the SQL query output without parentheses

Here is my code in the flask app from flask import Flask, render_template from flask_mysqldb import MySQL import MySQLdb.cursors app = Flask(__name__) app.config['MYSQL_HOST'] = 'localhost' app.config['MYSQL_USER'] =…
0
votes
1 answer

SQL Server update statement based on Select Statement with multiple values

I have a Select Statement which works well, producing 7636 rows: SELECT c.ClientId FROM dbo.tblTreatment e JOIN dbo.tblProgramAssessment pa ON pa.TreatmentID = e.TreatmentId JOIN #Client c ON c.ClientId = e.ClientId …
Mo_Dlg
  • 73
  • 1
  • 9
0
votes
1 answer

Can @SqlResultSetMapping be used to map a complex Dto object

I currently have a named native query set up in CrudRepository where I'm joinnig few tables and I need to map that query result into a Dto. select event_id, replaced_by_match_id, scheduled, start_time_tbd, status, away_team_competitor_id,…
0
votes
0 answers

SqlResultSetMapping Unknown mapping error

I am working on a Spring boot rest API and i asked a question earlier about mapping pojo class to result set Could not locate appropriate constructor on class..... the answers I got worked effectively but when I am using only one entity class and…
0
votes
0 answers

@ColumnResult maps to Character instead of String in JPA 2.0

In our software, we had a requirement that display name of one UI will be configurable according to user. So one user want to display another column from one table and another user want to display another column from same table. I think I can do…
user725455
  • 465
  • 10
  • 36
0
votes
0 answers

SQL query isn't working when embedded in java

I'm trying to connect the SQL plus database with java but it's not working , I'm using netbeabs ide 8.0.2 Here i have pasted following cod e in my submit button but when I execute it then it goes for the JOptionPane which is in else part whereas…
0
votes
0 answers

Mapping complex native query to a complex non-entity object in JPA/Hibernate

In mybatis we can define very complex mapping of the sql result set to an arbitrary complex dto object. Take a look at the example here: http://www.mybatis.org/mybatis-3/sqlmap-xml.html at the section "Advanced Result Maps" where we have a mapper…
Mladen Krstić
  • 188
  • 3
  • 11