So I have been lead to believe that this is the most efficient way of getting an auto-generated ID value from a database using a JDBCTemplate:
KeyHolder keyHolder = new GeneratedKeyHolder();
jdbcTemplate.update(
    new PreparedStatementCreator() {
        public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
            PreparedStatement ps =
                connection.prepareStatement(INSERT_SQL, new String[] {"开发者_如何转开发ID_FIELD"});
            // Configure the PreparedStatement HERE!
            return ps;
        }
    },
    keyHolder);
My problem is that I'm often inserting a variable number of values (JDBCTemplate.update(String, Object[]) is actually exactly what I need), and it looks like PreparedStatement allows insertion of one at a time (setString and the like). Looping through the array seems to be so... inelegant.
Well, since this is a tumbleweed, I'm guessing that there are no other ways to accomplish this. I ended up creating a class to handle this so that I can get around the requirement for final.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论