工具方法:
@Autowired private JdbcTemplate businessTpmeJdbcTemplate;
@SuppressWarnings("deprecation") public long querySeqBySeqName(String seqName) { try { return businessJdbcTemplate.queryForLong("SELECT " + seqName + ".NEXTVAL FROM DUAL"); } catch (DataAccessException e) { e.printStackTrace(); return 0; } }
@SuppressWarnings({ "unchecked", "rawtypes" }) public String queryFunByFunName(String FunName) { return (String) businessTpmeJdbcTemplate.query("SELECT " + FunName + "() FROM DUAL", new ResultSetExtractor() { @Override public Object extractData(ResultSet rs) throws SQLException, DataAccessException { final List<String> RESULT = new ArrayList<String>(); while (rs.next()) { RESULT.add(rs.getString(1)); } return RESULT.get(0); } }); }