Skip to content

Instantly share code, notes, and snippets.

@jerolba
Created August 26, 2018 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerolba/e795ab6443cf36f00c8438c7d0708b28 to your computer and use it in GitHub Desktop.
Save jerolba/e795ab6443cf36f00c8438c7d0708b28 to your computer and use it in GitHub Desktop.
JDBC, a register each time
connection.setAutoCommit(true);
try (PreparedStatement pstmt = connection.prepareStatement(TripEntityInsert.INSERT)) {
Iterator<TripEntity> iterator = trips.iterator();
while (iterator.hasNext()) {
tripInsert.setParameters(pstmt, iterator.next());
pstmt.executeUpdate();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment