### Question:
MySQLIntervalLock extends JdbcIntervalLock { @Override protected String buildTryLockSql(TableConfig tableConfig) { return new StringBuilder() .append("INSERT INTO ") .append(getSafeName(tableConfig.getSchema())) .append(".") .append(getSafeName(tableConfig.getTable())) .append(" (") .append(getSafeName(tableConfig.getName())) .append(", ") .append(getSafeName(tableConfig.getOwner())) .append(", ") .append(getSafeName(tableConfig.getAt())) .append(", ") .append(getSafeName(tableConfig.getTill())) .append(")\nSELECT ") .append(getValueName(tableConfig.getName())) .append(", ") .append(getValueName(tableConfig.getOwner())) .append(", CURRENT_TIMESTAMP(), ") .append("CURRENT_TIMESTAMP() + INTERVAL " + getValueName(tableConfig.getTill()) + " SECOND") .append("\nFROM dual") .append("\nWHERE CURRENT_TIMESTAMP() > (SELECT COALESCE(MAX(") .append(getSafeName(tableConfig.getTill())) .append("), '1923-10-29') FROM ") .append(getSafeName(tableConfig.getSchema())) .append(".") .append(getSafeName(tableConfig.getTable())) .append(" AS dlock_read WHERE ") .append(getSafeName(tableConfig.getName()) + "=" + getValueName(tableConfig.getName())) .append(")") .toString(); } MySQLIntervalLock(DataSource dataSource);  MySQLIntervalLock(
      NamedParameterJdbcTemplate jdbcTemplate, DataSourceTransactionManager transactionManager);  MySQLIntervalLock(DataSource dataSource,
      TableConfig tableConfig);  MySQLIntervalLock(NamedParameterJdbcTemplate jdbcTemplate,
      DataSourceTransactionManager transactionManager, TableConfig tableConfig); @Override boolean tryLock(final LockConfig lockConfig);  }### Answer:
@Test public void builtTryLockSql() throws IOException { MySQLIntervalLock mySQLIntervalLock = new MySQLIntervalLock(dataSource); String tryLockSQL = mySQLIntervalLock.buildTryLockSql(new TableConfig()); assertEquals( "INSERT INTO `public`.`lock` (`name`, `owner`, `locked_at`, `locked_till`)\n" + "SELECT :name, :owner, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP() + INTERVAL :locked_till SECOND\n" + "FROM dual\n" + "WHERE CURRENT_TIMESTAMP() > (SELECT COALESCE(MAX(`locked_till`), '1923-10-29') " + "FROM `public`.`lock` AS dlock_read WHERE `name`=:name)", tryLockSQL); }