private EntityManager createEntityManager(){
  EntityManager entityManager=entityManagerFactory.createEntityManager();
  entityManager.setFlushMode(FlushModeType.COMMIT);
  entityManagerThreadLocal.set(entityManager);
  return entityManager;
}

private EntityManager createEntityManager ( ) { EntityManager entityManager = entityManagerFactory . createEntityManager ( ) ; entityManager . setFlushMode ( FlushModeType . COMMIT ) ; entityManagerThreadLocal . set ( entityManager ) ; return entityManager ; }
creates a new entity manager that does not auto commit .
