Example usage for org.springframework.batch.core.repository.support JobRepositoryFactoryBean setTablePrefix

List of usage examples for org.springframework.batch.core.repository.support JobRepositoryFactoryBean setTablePrefix

Introduction

In this page you can find the example usage for org.springframework.batch.core.repository.support JobRepositoryFactoryBean setTablePrefix.

Prototype

public void setTablePrefix(String tablePrefix) 

Source Link

Document

Sets the table prefix for all the batch meta-data tables.

Usage

From source file:de.codecentric.batch.configuration.TaskExecutorBatchConfigurer.java

protected JobRepository createJobRepository() throws Exception {
    JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
    factory.setDataSource(dataSource);// w  w  w .ja  v a 2s .  c  om
    factory.setTransactionManager(transactionManager);
    String isolationLevelForCreate = env.getProperty("batch.repository.isolationlevelforcreate");
    if (isolationLevelForCreate != null) {
        factory.setIsolationLevelForCreate(isolationLevelForCreate);
    }
    String tablePrefix = env.getProperty("batch.repository.tableprefix");
    if (tablePrefix != null) {
        factory.setTablePrefix(tablePrefix);
    }
    factory.afterPropertiesSet();
    return factory.getObject();
}

From source file:org.springframework.boot.autoconfigure.batch.BasicBatchConfigurer.java

protected JobRepository createJobRepository() throws Exception {
    JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
    factory.setDataSource(this.dataSource);
    if (this.entityManagerFactory != null) {
        logger.warn(//  ww  w .  j  av a  2s  .com
                "JPA does not support custom isolation levels, so locks may not be taken when launching Jobs");
        factory.setIsolationLevelForCreate("ISOLATION_DEFAULT");
    }
    String tablePrefix = this.properties.getTablePrefix();
    if (StringUtils.hasText(tablePrefix)) {
        factory.setTablePrefix(tablePrefix);
    }
    factory.setTransactionManager(getTransactionManager());
    factory.afterPropertiesSet();
    return factory.getObject();
}