if (this.discoverUnregisteredNewObjectsWithoutPersist){
super.discoverUnregisteredNewObjects(clones, newObjects, unregisteredExistingObjects, visitedObjects);
}else{
//Bug#438193 : Replace HashSet with IdentityHashSet below for cascadePersistErrors so that the comparison will be by reference and
//not by equals() which invokes hashCode()
Set<Object> cascadePersistErrors = new IdentityHashSet();
for (Iterator clonesEnum = clones.keySet().iterator(); clonesEnum.hasNext(); ) {
discoverAndPersistUnregisteredNewObjects(clonesEnum.next(), false, newObjects, unregisteredExistingObjects, visitedObjects, cascadePersistErrors);
}
// EL Bug 343925 - Throw IllegalStateException with all unregistered objects which
// are not marked with CascadeType.PERSIST after iterating through all mappings.
if (!cascadePersistErrors.isEmpty()) {
throw new IllegalStateException(ExceptionLocalization.buildMessage("new_object_found_during_commit", cascadePersistErrors.toArray()));
}
}
}