3

can we be able to change the names of these tables?

  Default Table Name->Customize Name
 -----------------------------------------
• BATCH_JOB_INSTANCE->JobInstanceDescription
• BATCH_JOB_PARAMS-> JobExecutionParameters
• BATCH_JOB_EXECUTION[Customized Name Will Be Provided In Similar Fashion]
• BATCH_JOB_EXECUTION_CONTEXT->[Customized Name Will Be Provided In Similar Fashion]
• BATCH_STEP_EXECUTION->[Customized Name Will Be Provided In Similar Fashion]
• BATCH_STEP_EXECUTION_CONTEXT->[Customized Name Will Be Provided In Similar Fashion]
prajitgandhi
  • 483
  • 1
  • 5
  • 20
  • https://stackoverflow.com/questions/37436658/spring-batch-table-prefix-when-using-java-config – StanislavL Jul 13 '17 at 06:30
  • 1
    @StanislavL : I guess, prefix would only change table name prefix but having prefix property retains suffix part too like - `GFA.BATCH_JOB_INSTANCE` so `JOB_INSTANCE` etc will be appended to that prefix. What OP is looking for is full table name change without these suffixes. I will explore but as far I know, that wouldn't be possible. – Sabir Khan Jul 14 '17 at 07:22
  • @StanislavL I have checked that before asking the question.As Sabir Khan mentioned only prefix part can be changed but changing suffix is not known.Also i have checked documentation for Spring batch 3.0.0 but it seems that part is not documented.May be I have to custom build Spring batch framework for my use case by changing source code and schema files. – prajitgandhi Jul 14 '17 at 07:46

1 Answers1

4

No, Its not possible to fully rename a Spring Batch meta data table. Only prefix part can be changed.

My answer is based on the fact that I looked at codes of few classes in Spring Batch API like - org.springframework.batch.core.repository.dao.JdbcExecutionContextDao & org.springframework.batch.core.repository.dao.JdbcJobInstanceDao

and these classes are using hard coded queries like -

private static final String CREATE_JOB_INSTANCE = "INSERT into %PREFIX%JOB_INSTANCE(JOB_INSTANCE_ID, JOB_NAME, JOB_KEY, VERSION)" + " values (?, ?, ?, ?)";

&

private static final String FIND_JOB_EXECUTION_CONTEXT = "SELECT SHORT_CONTEXT, SERIALIZED_CONTEXT " + "FROM %PREFIX%JOB_EXECUTION_CONTEXT WHERE JOB_EXECUTION_ID = ?"; etc etc.

so suffix parts like JOB_INSTANCE & JOB_EXECUTION_CONTEXT are hard coded so it can't be changed.

Sabir Khan
  • 9,826
  • 7
  • 45
  • 98
  • My company policy is say that a table can not have name lenght more than 30 so it would be nice if we can change the metadata table names. – fuat Dec 23 '21 at 12:50