code: @Override
      public T update(T entity) {
          EntityManager entityManager = getEntityManager();
          T result = entityManager.merge(entity);
          return result;
      }
docs: Updates an entity in the database. It calls
  {@link EntityManager#merge(java.lang.Object) } and throws the same
  exceptions.
  
  @param entity the updates to the entity.
  
  @return the updated entity.