use of net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateLockProvider.ColumnNames in project ShedLock by lukas-krecan.
the class HsqlJdbcTemplateLockProviderIntegrationTest method shouldBeAbleToSetCustomColumnNames.
@Test
public void shouldBeAbleToSetCustomColumnNames() throws SQLException {
try (Connection conn = dbConfig.getDataSource().getConnection();
Statement statement = conn.createStatement()) {
statement.execute("CREATE TABLE shdlck(n VARCHAR(64), lck_untl TIMESTAMP(3), lckd_at TIMESTAMP(3), lckd_by VARCHAR(255), PRIMARY KEY (n))");
}
JdbcTemplateLockProvider provider = new JdbcTemplateLockProvider(builder().withTableName("shdlck").withColumnNames(new ColumnNames("n", "lck_untl", "lckd_at", "lckd_by")).withJdbcTemplate(new JdbcTemplate(dbConfig.getDataSource())).withLockedByValue("my-value").build());
Optional<SimpleLock> lock = provider.lock(new LockConfiguration(now(), "test", Duration.ofSeconds(10), Duration.ZERO));
lock.get().unlock();
}
Aggregations