prajitgandhi
prajitgandhi

Reputation: 493

Can we customize Spring Batch meta tables?

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]

Upvotes: 3

Views: 3354

Answers (1)

Sabir Khan
Sabir Khan

Reputation: 10132

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.

Upvotes: 4

Related Questions