Skip to content

Instantly share code, notes, and snippets.

@jerolba
Last active August 20, 2018 21:56
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/f6ba04bc873a93876b4ea555aa69e197 to your computer and use it in GitHub Desktop.
Save jerolba/f6ba04bc873a93876b4ea555aa69e197 to your computer and use it in GitHub Desktop.
A register each time
EntityTransaction tx = entityManager.getTransaction();
Iterator<TripEntity> iterator = trips.iterator();
while (iterator.hasNext()) {
tx.begin();
entityManager.persist(iterator.next());
tx.commit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment