@Override
  public void resetOriginalValues() {
    FooModelImpl fooModelImpl = this;

    fooModelImpl._originalField2 = fooModelImpl._field2;

    fooModelImpl._setOriginalField2 = false;

    fooModelImpl._columnBitmask = 0;
  }
  @Override
  public Foo updateImpl(com.liferay.testpacl.model.Foo foo) {
    foo = toUnwrappedModel(foo);

    boolean isNew = foo.isNew();

    FooModelImpl fooModelImpl = (FooModelImpl) foo;

    Session session = null;

    try {
      session = openSession();

      if (foo.isNew()) {
        session.save(foo);

        foo.setNew(false);
      } else {
        session.merge(foo);
      }
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !FooModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    } else {
      if ((fooModelImpl.getColumnBitmask()
              & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FIELD2.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {fooModelImpl.getOriginalField2()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_FIELD2, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FIELD2, args);

        args = new Object[] {fooModelImpl.getField2()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_FIELD2, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FIELD2, args);
      }
    }

    EntityCacheUtil.putResult(
        FooModelImpl.ENTITY_CACHE_ENABLED, FooImpl.class, foo.getPrimaryKey(), foo, false);

    foo.resetOriginalValues();

    return foo;
  }