spring-batch

Spring Boot - Reconnect to a database after its restart

末鹿安然 提交于 2020-01-24 21:48:09
问题 I have an Spring Batch application, which runs every 10 minutes. It gets some data from a REST API and then it saves these data on a database. Well, where is my problem now? Sometimes the database (Oracle) may restart, or go offline (no idea, really). But the application doesn't seem to reconnect to the database. It just stays on an idle mode. Spring Boot: 2.1.2.RELEASE The application.yml looks like this: app: database: jdbc-url: jdbc:oracle:thin:@<host>:<port>:<db> username: <username>

Error while indexing in Hibernate Search (before transaction completion)

自闭症网瘾萝莉.ら 提交于 2020-01-24 18:16:11
问题 I am tired of banging my head around this problem So if anyone could suggest me where I am wrong I'll be grateful. The problem is I am using Spring-Batch and Hibernate Full-Text Search in my Spring MVC project.So from the batch job Tasklet I am calling following code: A a=aDao.merge(a); b.setA(a); bDao.save(b); While doing the save update on these entites I am getting an exception and the stacktrace is as follows: org.springframework.orm.hibernate3.HibernateSystemException: Error while

How to run a step in a loop in Spring Batch : Updated

巧了我就是萌 提交于 2020-01-24 10:22:29
问题 I have below spring batch job: <job id="MyBatchJob" job-repository="jobRepository"> <step id="ConfigurationReadStep"> <tasklet ref="ConfigurationReadTasklet" transaction-manager="jobRepository-transactionManager"/> <next on="COMPLETED" to="NextStep" /> </step> <step id="NextStep"> <tasklet transaction-manager="jobRepository-transactionManager"> <chunk reader="myItemReader" writer="myItemWriter" commit-interval="1000"/> </tasklet> </step> <listeners> <listener ref="jobListener" /> </listeners>

How to run a step in a loop in Spring Batch : Updated

ぃ、小莉子 提交于 2020-01-24 10:22:09
问题 I have below spring batch job: <job id="MyBatchJob" job-repository="jobRepository"> <step id="ConfigurationReadStep"> <tasklet ref="ConfigurationReadTasklet" transaction-manager="jobRepository-transactionManager"/> <next on="COMPLETED" to="NextStep" /> </step> <step id="NextStep"> <tasklet transaction-manager="jobRepository-transactionManager"> <chunk reader="myItemReader" writer="myItemWriter" commit-interval="1000"/> </tasklet> </step> <listeners> <listener ref="jobListener" /> </listeners>

Data Source for GCP Spanner

亡梦爱人 提交于 2020-01-23 21:42:48
问题 I am going to create batch for GCP spanner am planning to use JdbcCursorItemReader that needs datasource, So i need to create datasource for my GCP Spanner instance, Can you please suggest me on this? 回答1: You need to add the Cloud Spanner JDBC driver to your build path like this: <dependency> <groupId>com.google.cloud</groupId> <artifactId>google-cloud-spanner-jdbc</artifactId> <version>1.9.0</version> </dependency> Then you can define a Spring data source in the normal way. Doing it

Data Source for GCP Spanner

☆樱花仙子☆ 提交于 2020-01-23 21:42:09
问题 I am going to create batch for GCP spanner am planning to use JdbcCursorItemReader that needs datasource, So i need to create datasource for my GCP Spanner instance, Can you please suggest me on this? 回答1: You need to add the Cloud Spanner JDBC driver to your build path like this: <dependency> <groupId>com.google.cloud</groupId> <artifactId>google-cloud-spanner-jdbc</artifactId> <version>1.9.0</version> </dependency> Then you can define a Spring data source in the normal way. Doing it

How to create dynamic steps in Spring Batch

主宰稳场 提交于 2020-01-22 16:36:35
问题 I need to create 'N' number of steps, depending on the 'maxHierLevel value received from the database and execute them sequentially - int maxHierLevel = testService.getHighestLevel(); Step masterCalculationStep = stepBuilderFactory.get("CALCUL_STEP_1") .<Map<Long, List<CostCalculation>>, List<TempCostCalc>>chunk(1) .reader(reader) .processor(processor) .writer(writer) .build(); final Step[] stepsArray = new Step[maxHierLevel]; for (int i = 0; i < stepsArray.length; i++) { stepsArray [i] =

Partiton RDBMS ( DB2 ) table data either by SQL query or Java

五迷三道 提交于 2020-01-17 07:31:27
问题 I have to implement a partitioning for the column data ( Column Name : ID ) for a very large database table ( DB2 ). Table has more than a billion rows and keeps growing. Partitioning has to be implemented like illustrated here i.e. I have to calculate minId & maxId for a specified range. ID column values are unique but not sequential so simple approach as illustrated in above link will not work - i.e. starting from an ID then keep adding range. WITH ROWNUMTAB AS ( SELECT ROWNUM, ID FROM (

Failed to convert property value of type 'java.util.Collections$UnmodifiableMap' to required type 'org.springframework.batch.item.ExecutionContext'

落花浮王杯 提交于 2020-01-17 06:15:07
问题 I'm getting this error when I try to use StepExecutionContext, to share data between steps. I'm very noob at this framework so I hope it's an easy question, but as far I can tell, it must be on the framework since I dont use an "UnmodifiableMap" anywhere. If someone has run into this, it can be of great help to share the solution, thanks in advance. The bean is defined like: <bean id="Candidatos_itemProcessor" class="com.xxx.CandidatoProcessorTest" scope="step"> <property name="stepContext"

spring-batch read in null int values

青春壹個敷衍的年華 提交于 2020-01-17 01:29:09
问题 I have a file reader to read a customer csv file If the int fields are empty i get error Field error in object 'target' on field 'custPaymentTerm': rejected value []; codes [typeMismatch.target.custPaymentTerm,typeMismatch.custPaymentTerm,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [target.custPaymentTerm,custPaymentTerm]; arguments []; default message [custPaymentTerm]]; default message [Failed to convert property value