Commit 239b0a0f authored by Quxl's avatar Quxl

x

parent 1f66f21e
......@@ -4,6 +4,7 @@ import java.text.MessageFormat;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
......@@ -43,9 +44,13 @@ public class CommonService {
}
}
} catch (EmptyResultDataAccessException e) {
String sql = "insert into x_sequence (name, max, min, step, value) values (?, ?, ?, ?, ?)";
jdbcTemplate.update(sql, sName, Long.MAX_VALUE, 1L, 1L, 1L);
return this.getNextval(sName);
try {
String sql = "insert into x_sequence (name, max, min, step, value) values (?, ?, ?, ?, ?)";
jdbcTemplate.update(sql, sName, Long.MAX_VALUE, 1L, 1L, 1L);
return this.getNextval(sName);
} catch (DuplicateKeyException ex) {
return this.getNextval(sName);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment