Questions tagged [rowmapper]
28 questions
1
vote
0 answers
BeanPropertyRowMapper does not works with keyword AS?
I know that BeanPropertyRowMapper<>() can wrap fields comparing database fields to Class fields by name.
But why when I'm using keyword "AS" i get an error.
jdbcTemplate code
public Book showBook(int id) {
return…

Vandal
- 21
- 2
1
vote
1 answer
Using RowMapper for LocalDate
I have a class RowMapperFactory that can return an Employee in particular:
new Employee(
new BigInteger("7499"),
new FullName("JOHN", "ALLEN", "MARIA"),
…

Richard Walker
- 133
- 2
- 10
1
vote
0 answers
Can Spring JDBC DataClassRowMapper / BeanPropertyRowMapper be used as a singleton
Springs DataClassRowMapper seems to be thread safe.
However all examples I see, are constructing new instances on every use.
It is doing reflection on construction, so there is some costs on constructing it.
Can we create singleton instances for…

Kees van Dieren
- 1,232
- 11
- 15
1
vote
1 answer
JDBCTempalte RowMapper to read jsonb column in postgres table
I am reading the Postgres table using the JDBCTemplate, which has the below schema:
orderid|order_name|features|extra_features|
orderid: integer
order_name: text
features: josnb
extra_features: jsonb
Order DTO:
public class Order{
private…

mayank bisht
- 618
- 3
- 14
- 43
1
vote
0 answers
Spring: getting a single row from database using RowMapper
I'm trying to get single row from Oracle DB by using RowMapper in Spring, but I'm getting the following exception:
Exception in thread "main java.lang.NoClassDefFoundError:
org/springframework/dao/DuplicateKeyException
Can anyone explain me the…

Bala Krishna
- 11
- 2
0
votes
0 answers
How to JOIN tables in Spring JDBC?
I am creating a custom query in Spring using JDBC to join the tables that are in my Database, but when I check the endpoint in PostMan only the results one table appear. Any insight would be helpful.
This is the query:
@Override
public List…

biko
- 13
- 1
- 3
0
votes
0 answers
JdbcTemplate with Generic Nested Row Mapper with one to many relationships
I'm using spring with JdbcTemplates, java 1.8
I have the next class instead of rowMapper, and it works well:
public class NestedRowMapper implements RowMapper {
private final Class mappedClass;
public NestedRowMapper(Class mappedClass)…

Alex
- 671
- 5
- 19
0
votes
1 answer
How to use jdbcTemplate and rowmapper, if my dto class contains list in it?
I want to use rowMapper or jdbctemplate for one-to-many relation.
My dto class contains List of questions in course dto.
public class CourseQuestionsDto {
@NotNull(message="Course Id cannot be null.")
private Integer courseId;
…
0
votes
0 answers
Having a class with a Set parameter what is the best way to implement RowMapper for the Set parameter?
Would highly appreciate any suggestions. Am a newbie to Java/Spring and especially JdbcTemplate.
(also my first question on stackoverflow, hooray!)
I have a simple User.class:
@Data
@Slf4j
@Builder
public class User {
protected long id;
…
0
votes
0 answers
How to excute subqueries :Spring Boot JDBC Template can't execute Queries containing nested Query in the FROM clause
023-03-10 03:57:05.836 ERROR 28224 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is…
0
votes
0 answers
Mock NamedParameterJdbcTemplate with callback function
Im trying to mock NamedParameterJdbcTemplate inside LaAttributeRepo Calss having below method findFieldByItemId
SqlParameterSource param = new MapSqlParameterSource("laIds", laIds);
List < LaAttributes > laAttributes =…

Sumit Kumar
- 9
- 3
0
votes
2 answers
Create ArrayList from Postgresql query
I have following class:
public class Person {
private String firstName;
private String lastName;
private List habits;
}
I have Postgres query which returns me following result using inner join from 2 tables
name | lastname| …

Vasek
- 3
- 2
0
votes
1 answer
UnableToCreateStatementException JDBI3 using in caluse rowMapper
I have this query that when is executed I have an expection
@SqlQuery("SELECT * FROM TABLEA WHERE m= :mAND values in ()")
@RegisterRowMapper(TableARsMapper.class)
Optional getByValues(@BindList("values") List values,…

mdc
- 3
- 1
0
votes
0 answers
invalid stream header: EFBFBDEF when trying to get data from serialized object in database
I need to get serialized object from this table(it`s not a file or image. Just a table with columns in database which stored client with serialized data), but when i try to read Object i have an Exception in thread "main"…

Feel free
- 758
- 5
- 15
0
votes
1 answer
Generic RowMapper JDBC
I am trying to create a generic row mapper for JDBC.
My initial attempt looks like:
public class GenericRowMapper implements RowMapper {
private final Class> clazz;
public GenericRowMapper(T instance) {
this.clazz =…

Alex Vergara
- 1,766
- 1
- 10
- 29