+ try {
+ if (entityManager.isOpen()) {
+ entityManager.flush();
+ }
+ } catch (TransactionRequiredException e) {
+ throw e;
+ } catch (PersistenceException e) {
+ throw e;
+ } catch (Exception e) {
+ LOGGER.log(Level.WARNING, "Could not flush entitymanager", e);
+ }