@Override
  protected LayoutSet removeImpl(LayoutSet layoutSet) throws SystemException {
    layoutSet = toUnwrappedModel(layoutSet);

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.delete(session, layoutSet);
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

    LayoutSetModelImpl layoutSetModelImpl = (LayoutSetModelImpl) layoutSet;

    FinderCacheUtil.removeResult(
        FINDER_PATH_FETCH_BY_G_P,
        new Object[] {
          Long.valueOf(layoutSetModelImpl.getGroupId()),
          Boolean.valueOf(layoutSetModelImpl.getPrivateLayout())
        });

    EntityCacheUtil.removeResult(
        LayoutSetModelImpl.ENTITY_CACHE_ENABLED, LayoutSetImpl.class, layoutSet.getPrimaryKey());

    return layoutSet;
  }
  @Override
  protected Ticket removeImpl(Ticket ticket) throws SystemException {
    ticket = toUnwrappedModel(ticket);

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.delete(session, ticket);
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

    TicketModelImpl ticketModelImpl = (TicketModelImpl) ticket;

    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_KEY, new Object[] {ticketModelImpl.getKey()});

    EntityCacheUtil.removeResult(
        TicketModelImpl.ENTITY_CACHE_ENABLED, TicketImpl.class, ticket.getPrimaryKey());

    return ticket;
  }
  @Override
  public LayoutSet updateImpl(com.liferay.portal.model.LayoutSet layoutSet, boolean merge)
      throws SystemException {
    layoutSet = toUnwrappedModel(layoutSet);

    boolean isNew = layoutSet.isNew();

    LayoutSetModelImpl layoutSetModelImpl = (LayoutSetModelImpl) layoutSet;

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, layoutSet, merge);

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

    EntityCacheUtil.putResult(
        LayoutSetModelImpl.ENTITY_CACHE_ENABLED,
        LayoutSetImpl.class,
        layoutSet.getPrimaryKey(),
        layoutSet);

    if (!isNew
        && ((layoutSet.getGroupId() != layoutSetModelImpl.getOriginalGroupId())
            || (layoutSet.getPrivateLayout() != layoutSetModelImpl.getOriginalPrivateLayout()))) {
      FinderCacheUtil.removeResult(
          FINDER_PATH_FETCH_BY_G_P,
          new Object[] {
            Long.valueOf(layoutSetModelImpl.getOriginalGroupId()),
            Boolean.valueOf(layoutSetModelImpl.getOriginalPrivateLayout())
          });
    }

    if (isNew
        || ((layoutSet.getGroupId() != layoutSetModelImpl.getOriginalGroupId())
            || (layoutSet.getPrivateLayout() != layoutSetModelImpl.getOriginalPrivateLayout()))) {
      FinderCacheUtil.putResult(
          FINDER_PATH_FETCH_BY_G_P,
          new Object[] {
            Long.valueOf(layoutSet.getGroupId()), Boolean.valueOf(layoutSet.getPrivateLayout())
          },
          layoutSet);
    }

    return layoutSet;
  }
  @Override
  public ClassName updateImpl(com.liferay.portal.model.ClassName className, boolean merge)
      throws SystemException {
    className = toUnwrappedModel(className);

    boolean isNew = className.isNew();

    ClassNameModelImpl classNameModelImpl = (ClassNameModelImpl) className;

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, className, merge);

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !ClassNameModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    }

    EntityCacheUtil.putResult(
        ClassNameModelImpl.ENTITY_CACHE_ENABLED,
        ClassNameImpl.class,
        className.getPrimaryKey(),
        className);

    if (isNew) {
      FinderCacheUtil.putResult(
          FINDER_PATH_FETCH_BY_VALUE, new Object[] {className.getValue()}, className);
    } else {
      if ((classNameModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_VALUE.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {classNameModelImpl.getOriginalValue()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_VALUE, args);
        FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_VALUE, args);

        FinderCacheUtil.putResult(
            FINDER_PATH_FETCH_BY_VALUE, new Object[] {className.getValue()}, className);
      }
    }

    return className;
  }
  @Override
  public Ticket updateImpl(com.liferay.portal.model.Ticket ticket, boolean merge)
      throws SystemException {
    ticket = toUnwrappedModel(ticket);

    boolean isNew = ticket.isNew();

    TicketModelImpl ticketModelImpl = (TicketModelImpl) ticket;

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, ticket, merge);

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !TicketModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    }

    EntityCacheUtil.putResult(
        TicketModelImpl.ENTITY_CACHE_ENABLED, TicketImpl.class, ticket.getPrimaryKey(), ticket);

    if (isNew) {
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_KEY, new Object[] {ticket.getKey()}, ticket);
    } else {
      if ((ticketModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_KEY.getColumnBitmask()) != 0) {
        Object[] args = new Object[] {ticketModelImpl.getOriginalKey()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_KEY, args);
        FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_KEY, args);

        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_KEY, new Object[] {ticket.getKey()}, ticket);
      }
    }

    return ticket;
  }
  @Override
  protected ClassName removeImpl(ClassName className) throws SystemException {
    className = toUnwrappedModel(className);

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.delete(session, className);
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    clearCache(className);

    return className;
  }
  @Override
  protected WebDAVProps removeImpl(WebDAVProps webDAVProps) throws SystemException {
    webDAVProps = toUnwrappedModel(webDAVProps);

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.delete(session, webDAVProps);
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    clearCache(webDAVProps);

    return webDAVProps;
  }
  @Override
  protected Ticket removeImpl(Ticket ticket) throws SystemException {
    ticket = toUnwrappedModel(ticket);

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.delete(session, ticket);
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    clearCache(ticket);

    return ticket;
  }
  @Override
  public Ticket updateImpl(com.liferay.portal.model.Ticket ticket, boolean merge)
      throws SystemException {
    ticket = toUnwrappedModel(ticket);

    boolean isNew = ticket.isNew();

    TicketModelImpl ticketModelImpl = (TicketModelImpl) ticket;

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, ticket, merge);

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

    EntityCacheUtil.putResult(
        TicketModelImpl.ENTITY_CACHE_ENABLED, TicketImpl.class, ticket.getPrimaryKey(), ticket);

    if (!isNew && (!Validator.equals(ticket.getKey(), ticketModelImpl.getOriginalKey()))) {
      FinderCacheUtil.removeResult(
          FINDER_PATH_FETCH_BY_KEY, new Object[] {ticketModelImpl.getOriginalKey()});
    }

    if (isNew || (!Validator.equals(ticket.getKey(), ticketModelImpl.getOriginalKey()))) {
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_KEY, new Object[] {ticket.getKey()}, ticket);
    }

    return ticket;
  }
  @Override
  public WebDAVProps updateImpl(com.liferay.portal.model.WebDAVProps webDAVProps, boolean merge)
      throws SystemException {
    webDAVProps = toUnwrappedModel(webDAVProps);

    boolean isNew = webDAVProps.isNew();

    WebDAVPropsModelImpl webDAVPropsModelImpl = (WebDAVPropsModelImpl) webDAVProps;

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, webDAVProps, merge);

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !WebDAVPropsModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    }

    EntityCacheUtil.putResult(
        WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
        WebDAVPropsImpl.class,
        webDAVProps.getPrimaryKey(),
        webDAVProps);

    if (isNew) {
      FinderCacheUtil.putResult(
          FINDER_PATH_FETCH_BY_C_C,
          new Object[] {
            Long.valueOf(webDAVProps.getClassNameId()), Long.valueOf(webDAVProps.getClassPK())
          },
          webDAVProps);
    } else {
      if ((webDAVPropsModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_C_C.getColumnBitmask())
          != 0) {
        Object[] args =
            new Object[] {
              Long.valueOf(webDAVPropsModelImpl.getOriginalClassNameId()),
              Long.valueOf(webDAVPropsModelImpl.getOriginalClassPK())
            };

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
        FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C, args);

        FinderCacheUtil.putResult(
            FINDER_PATH_FETCH_BY_C_C,
            new Object[] {
              Long.valueOf(webDAVProps.getClassNameId()), Long.valueOf(webDAVProps.getClassPK())
            },
            webDAVProps);
      }
    }

    return webDAVProps;
  }