Questions tagged [namedparameterjdbctemplate]

13 questions
0
votes
0 answers

Spring NamedParameterJdbcTemplate is slow in Select query using HikariCP

I am using Spring NamedParameterJdbcTemplate using Hikar datasource using Oracle database.. I have scenario where it makes a select query in a loop for 200 times. It works fine for 75th loop but after that it gets slow and taking lots of time around…
0
votes
1 answer

JdbcTemplate in JdbcBatchItemWriter is removing the column name timestamp in the insert statement

We are using the Spring Batch for syncing records from one DB to another. The target table definition is like this: CREATE TABLE entity_name ( entity_id varchar(255) NOT NULL, value varchar(255) NOT NULL, source varchar(255) NULL, …
0
votes
0 answers

Combine 2 MapSqlParameterSource in Spring boot Java

How to combine 2 MapSqlParameterSource in Spring boot Java? Not Working: private MapSqlParameterSource mapFn1(Object A) { MapSqlParameterSource mapSql = new MapSqlParameterSource(); mapSql.addValue("name", A.getName); mapSql.addValue("age",…
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

How to use named paramater in SELECT query statement in NamedParameterJdbcTemplate

Here is the query- sql = "SELECT EMP_NAME, EMP_NUMBER, EMP_JOINING_DATE, :joiningDate as NAMED_PARAM_DATE from EMP_TABLE where EMP_JOINING_DATE>:joiningDate" code: NamedParameterJdbcTemplate jdbcTemplate; ..... MapSqlParameterSource sqlParams = new…
San4musa
  • 277
  • 2
  • 12
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 =…
0
votes
0 answers

JUnit Integration Testing NamedJdbcTemplate

I have a Repository class RaRepository as below @Repository public class RaRepository{ @Autowired private NamedParameterJdbcTemplate jdbcTemplate; public List findFieldsByItemId(list itemsId){ String sql = "select * from abc…
0
votes
1 answer

@Transactional timeout is not working in spring boot application

I am using Spring Boot and JdbcTemplate in my application. I am trying to implement timeout for select query but its not working. My query takes more time than timeout time but still its not giving timeout exception. @Service @Slf4j public class…
0
votes
1 answer

Convert from a list to an array of `SqlParameterSource`. A.K.A. convert a list to an array of maps

I have a list of entities which I want to relate to another entity using JDBC named template. For that, I am inserting the ID pairs on the join table using a batch update operation, but the problem is that the way I have found to generate an array…
MikelAlejoBR
  • 302
  • 5
  • 15
0
votes
0 answers

Get Statement object from NamedJdbctemplate execute/query

How to properly get reference to the Statment object inside the NamedParameterJdbcTemplate query/exeucte/update. I need the reference because I have a button on the GUI to stop the running query (connection.close() & statement.close() & release…
SüniÚr
  • 826
  • 1
  • 16
  • 33
0
votes
0 answers

namedJdbcTemplate.update not working for list of string

I am trying to use named jdbctemplate.update to fire a delete query but somehow this query is not working. This is my code Order looks something like this public class Order { private Long cuId; private String supplierType; private String…
0
votes
0 answers

Batchupdate is freezed only for large number of rows

From my spring java code, i am trying to insert 13,500 rows into a table in oracle database through below step. NamedParameterJdbsTemplate.batchupdate(insert quert, listname. Toarray(new map(list.size()); But the process gets freeze at this step,…
0
votes
0 answers

Column missing in Spring's namedParameterJdbcTemplate query when using UNION ALL

Fairly normal looking query, two basically identical selects, but in the second one the RVC table is omitted, and NULLS are used. Query works fine in the console, and column headers come from the first select in the join. Fully specifying the JDBC…
ggb667
  • 1,881
  • 2
  • 20
  • 44