final List<List<Entity>> partitionedList = ListUtils.partition( massiveList, 50 ); for ( List<Entity> subList : partitionedList ) {
entityManager.getTransaction().begin();
for ( Entity entity : subList ) {
entityManager.persist( entity );
}
entityManager.getTransaction().commit();
}