25 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
1
vote
1
answer
462
views
Should BeanPropertyRowMapper be singleton or declared in each query?
I am using BeanPropertyRowMapper. Should BeanPropertyRowMapper be called for every JdbcTemplate query, be a prototype, or a singleton in the application? My application has multithreading requests ...
1
vote
0
answers
366
views
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.
...
0
votes
0
answers
331
views
Mock NamedParameterJdbcTemplate with callback function
Im trying to mock NamedParameterJdbcTemplate inside LaAttributeRepo Calss having below method findFieldByItemId
SqlParameterSource param = new MapSqlParameterSource("laIds", laIds);
List &...
0
votes
2
answers
292
views
Create ArrayList from Postgresql query
I have following class:
public class Person {
private String firstName;
private String lastName;
private List<String> habits;
}
I have Postgres query which returns me following result using ...
1
vote
0
answers
56
views
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 ...
0
votes
1
answer
320
views
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 (<values>)")
@RegisterRowMapper(TableARsMapper.class)
Optional<...
0
votes
2
answers
1k
views
Java: Deserializing Objects from Database Table Throws StreamCorruptedException
I'm working on deserializing objects stored in a database table. When attempting to read the serialized data using ObjectInputStream, I encounter a StreamCorruptedException with the message 'invalid ...
0
votes
1
answer
1k
views
Generic RowMapper JDBC
I am trying to create a generic row mapper for JDBC.
My initial attempt looks like:
public class GenericRowMapper<T> implements RowMapper<T> {
private final Class<?> clazz;
...
1
vote
1
answer
2k
views
Using RowMapper for LocalDate
I have a class RowMapperFactory that can return an Employee in particular:
new Employee(
new BigInteger("7499"),
new FullName("...
0
votes
1
answer
448
views
Declaring a RowMapper with a lambda expression -- Wrong number of parameters: Expected 1 but got 2
I'm learning Spring and I was following along with this tutorial, but suddenly I started getting an error around this RowMapper assignment.
RowMapper<Person> rowMapper = (resultSet, i) -> {
...
1
vote
1
answer
1k
views
Rowmapper vs ResultSetExtractor in spring
I'm facing weird issue with Spring jdbc RowMapper:-
Here is my code
public void test(){
String sql=" Query will fetch records where dateColumn<='2021-08-17' Limit 1";
jdbcTemplate....
1
vote
0
answers
1k
views
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 ...
0
votes
1
answer
55
views
How to get list's itself while RowMapping with Maven in java
I am getting an error because of the type required in emails. It requires List<java.lang.String> but I wanted to ask would .emails((List<String>) resultSet.getObject("emails")); ...
0
votes
1
answer
1k
views
Resultset in RowMapper For JdbcCursorItemReader
I'm trying to understand how JdbcCursorItemReader works. I noticed that the ItemReader read() method eventually calls readCursor() method from JdbcCursorItemReader where we pass the complete resultset ...
0
votes
1
answer
3k
views
How to mock jdbctemplate query with beanpropertyrowmapper?
question, how can i mock this method ?
return jdbcTemplate.query(query.toString(), new BeanPropertyRowMapper<>(TarjetaCoordenada.class), id);
@Override
public <T> List<T> query(...