altName, email, type, endEntityProfileId, userDataVO.getCertificateProfileId(),
userDataVO.getTokenType(), userDataVO.getHardTokenIssuerId(), userDataVO.getExtendedinformation());
// Since persist will not commit and fail if the user already exists, we need to check for this
// Flushing the entityManager will not allow us to rollback the persisted user if this is a part of a larger transaction.
if (UserData.findByUsername(entityManager, username) != null) {
throw new EntityExistsException("User " + username + " already exists.");
}
entityManager.persist(userData);
// Although UserDataVO should always have a null password for
// autogenerated end entities, the notification framework
// expect it to exist. Since nothing else but printing is done after