Ben Yu

Results 27 comments of Ben Yu

That's an intruiguing question! For the moment I can't think of a good API to directly integrate batching. But for now, at least you can still use the SQL template...

Good call! I've added `prepareToBatch()`. It returns a `Template` upon each call. Usage pattern will be like: ```java Template insertUser = sql.prepareToBatch(connection, ...); Set batches = new HashSet(); for (...)...

You can use `prepareToBatch()` in release 9.5

The `Template` interface isn't an `AutoCloseable`. The hope is that the caller just calls `Connection.close()` in a try-with-resources and all the statements will be closed. Will that pattern work for...

For batching, you could still perform a tidy batch with: ```java void insertUsers(Connection connection, List users) throws SQLException { checkArgument(users.size() > 0); var insertUser = SafeSql.prepareToBatch(connection, ...); try (PreparedStatement batch...

This isn't using `SafeSql`, right? Imho, if you will be closing the connection soon-ish (like for the current request), there is no need to worry about unclosed temporary statements upon...

Oh I see. Yeah, as suggested in the javadoc, it's expected that the caller manages these jdbc resources through the connection. This is in compliance with JDBC spec: > Releases...