Questions tagged [jdbcnamedparametertemplate]

10 questions
3
votes
2 answers

Insert batch and Return full object using NamedParameterJdbcTemplate

I am trying to do batch insertion to a table and then read full objects back with their newly generated ids. private List saveCustomer(List customerList, Long shopId) { AtomicInteger index = new AtomicInteger(); …
1
vote
0 answers

Spring Boot Application using Oracle - ORA-01000: maximum open cursors exceeded while using Spring Jdbctemplate

I know there are lot of solution for this in internet but nothing seems to work for me. I have following entries for in the pom.xml file for my jdk11 app org.springframework.boot
1
vote
2 answers

How to pass interval parameter into sql request using namedparameterjdbctemplate java

I am dealing with NamedParameterJdbcTemplate in java. I'm trying through NamedParameterJdbcTemplate to pass the interval parameter (3 month) to the sql query DELETE FROM message WHERE dt_log
1
vote
1 answer

Unable to do batch update with Subquery in Insert or Update in Spring boot NamedParameterJdbcTemplate

Am trying to insert mutiple records using NamedParameterJdbcTemplate batchupdate. Am able to insert record without using subquery in Insert statement. But when I use Subquery its returning dataintegrityviolationexception Please find below code for…
0
votes
1 answer

How to update a column of table for bulk records using namedParameterJDBCTemplate batchUpdate?

I want update a column of table for bulk records. How can i do that using NamedParameterJdbcTemplate List ids = new ArrayList(); ids.add(1); ids.add(2); String updateQuery = "update product set status = 'P' where id = ?"; SqlParameterSource …
coder
  • 231
  • 3
  • 11
0
votes
0 answers

return primary Key after update namedParameterJdbc Spring boot

I have a query like this SCHEMA |Firm_Id|Name |global_firm_id| | 14 | Test| 9821 | firmId is PK global_firm_id is unique and not null UPDATE FIRMS SET name = (:firmName) WHERE global_firm_id = (:globalFirmId)"; in Spring boot I…
Praveen
  • 557
  • 1
  • 5
  • 20
0
votes
0 answers

SPRING NamedParameterJdbcTemplate return data after i stop the database service

I'm facing an issue when using NamedParameterJdbcTemplate in my Spring apps to query data from Oracle db. from insomnia/postman i send parameter with body "IDBILL":"9999" and i received the data billing, but when i tried negative scenario ( Oracle…
0
votes
0 answers

Avoiding quote insertion on NamedParameterJdbcTemplate parameterized query

thank you for taking the time to read. I am trying to execute a query using a JDBC connection to Snowflake via this line of code: namedParamJdbcTemplate.execute(sqlQuery, paramKeyValueMap, (PreparedStatementCallback) ps -> ps.executeUpdate()); Here…
0
votes
2 answers

Spring boot with Mockito mocking NamedParameterJdbcTemplate

Trying to unit test a method which is defined as : public void myMethod(List model){ int[] result = namedParameterJdbcTemplate.batchUpdate("update query", SqlParameterSourceUtils.createBatch(model)); } In my test class i am…
0
votes
1 answer

NoSuchBeanDefinitionException for NamedParameterJdbcTemplate in test class

I have a problem with running unit tests with JDBCTemplate in my spring boot application. I have the following code for configuration: @Configuration @ComponentScan("com.idoc.recon.persistence") public class SpringJDBCConfig { …