@Override
  public JIRAChangeItem updateImpl(com.liferay.socialcoding.model.JIRAChangeItem jiraChangeItem)
      throws SystemException {
    jiraChangeItem = toUnwrappedModel(jiraChangeItem);

    boolean isNew = jiraChangeItem.isNew();

    JIRAChangeItemModelImpl jiraChangeItemModelImpl = (JIRAChangeItemModelImpl) jiraChangeItem;

    Session session = null;

    try {
      session = openSession();

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

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !JIRAChangeItemModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    } else {
      if ((jiraChangeItemModelImpl.getColumnBitmask()
              & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_JIRACHANGEGROUPID.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {jiraChangeItemModelImpl.getOriginalJiraChangeGroupId()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_JIRACHANGEGROUPID, args);
        FinderCacheUtil.removeResult(
            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_JIRACHANGEGROUPID, args);

        args = new Object[] {jiraChangeItemModelImpl.getJiraChangeGroupId()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_JIRACHANGEGROUPID, args);
        FinderCacheUtil.removeResult(
            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_JIRACHANGEGROUPID, args);
      }
    }

    EntityCacheUtil.putResult(
        JIRAChangeItemModelImpl.ENTITY_CACHE_ENABLED,
        JIRAChangeItemImpl.class,
        jiraChangeItem.getPrimaryKey(),
        jiraChangeItem,
        false);

    jiraChangeItem.resetOriginalValues();

    return jiraChangeItem;
  }
  @Override
  public ListType updateImpl(ListType listType) {
    listType = toUnwrappedModel(listType);

    boolean isNew = listType.isNew();

    ListTypeModelImpl listTypeModelImpl = (ListTypeModelImpl) listType;

    Session session = null;

    try {
      session = openSession();

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

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !ListTypeModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    } else {
      if ((listTypeModelImpl.getColumnBitmask()
              & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TYPE.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {listTypeModelImpl.getOriginalType()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TYPE, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TYPE, args);

        args = new Object[] {listTypeModelImpl.getType()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TYPE, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TYPE, args);
      }
    }

    EntityCacheUtil.putResult(
        ListTypeModelImpl.ENTITY_CACHE_ENABLED,
        ListTypeImpl.class,
        listType.getPrimaryKey(),
        listType,
        false);

    clearUniqueFindersCache(listType);
    cacheUniqueFindersCache(listType);

    listType.resetOriginalValues();

    return listType;
  }
  protected void clearUniqueFindersCache(TipsOfTheDayUsers tipsOfTheDayUsers) {
    TipsOfTheDayUsersModelImpl tipsOfTheDayUsersModelImpl =
        (TipsOfTheDayUsersModelImpl) tipsOfTheDayUsers;

    Object[] args =
        new Object[] {
          tipsOfTheDayUsers.getCompanyId(),
          tipsOfTheDayUsers.getGroupId(),
          tipsOfTheDayUsers.getUserId()
        };

    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_G_U, args);
    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_G_U, args);

    if ((tipsOfTheDayUsersModelImpl.getColumnBitmask()
            & FINDER_PATH_FETCH_BY_C_G_U.getColumnBitmask())
        != 0) {
      args =
          new Object[] {
            tipsOfTheDayUsersModelImpl.getOriginalCompanyId(),
            tipsOfTheDayUsersModelImpl.getOriginalGroupId(),
            tipsOfTheDayUsersModelImpl.getOriginalUserId()
          };

      FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_G_U, args);
      FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_G_U, args);
    }
  }
  @Override
  public Quota updateImpl(org.lsug.quota.model.Quota quota, boolean merge) throws SystemException {
    quota = toUnwrappedModel(quota);

    boolean isNew = quota.isNew();

    QuotaModelImpl quotaModelImpl = (QuotaModelImpl) quota;

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, quota, merge);

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

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

    EntityCacheUtil.putResult(
        QuotaModelImpl.ENTITY_CACHE_ENABLED, QuotaImpl.class, quota.getPrimaryKey(), quota);

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

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CLASSNAMEIDCLASSPK, args);

        FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_CLASSNAMEIDCLASSPK, args);

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

    return quota;
  }
  @Override
  public ProjectsEntry updateImpl(com.liferay.so.model.ProjectsEntry projectsEntry)
      throws SystemException {
    projectsEntry = toUnwrappedModel(projectsEntry);

    boolean isNew = projectsEntry.isNew();

    ProjectsEntryModelImpl projectsEntryModelImpl = (ProjectsEntryModelImpl) projectsEntry;

    Session session = null;

    try {
      session = openSession();

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

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !ProjectsEntryModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    } else {
      if ((projectsEntryModelImpl.getColumnBitmask()
              & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {projectsEntryModelImpl.getOriginalUserId()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID, args);

        args = new Object[] {projectsEntryModelImpl.getUserId()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID, args);
      }
    }

    EntityCacheUtil.putResult(
        ProjectsEntryModelImpl.ENTITY_CACHE_ENABLED,
        ProjectsEntryImpl.class,
        projectsEntry.getPrimaryKey(),
        projectsEntry,
        false);

    projectsEntry.resetOriginalValues();

    return projectsEntry;
  }
  /**
   * Clears the cache for the ticket.
   *
   * <p>The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link
   * com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
   */
  @Override
  public void clearCache(Ticket ticket) {
    EntityCacheUtil.removeResult(
        TicketModelImpl.ENTITY_CACHE_ENABLED, TicketImpl.class, ticket.getPrimaryKey());

    FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL, FINDER_ARGS_EMPTY);

    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_KEY, new Object[] {ticket.getKey()});
  }
  @Override
  public ShoppingItemField updateImpl(
      com.liferay.portlet.shopping.model.ShoppingItemField shoppingItemField)
      throws SystemException {
    shoppingItemField = toUnwrappedModel(shoppingItemField);

    boolean isNew = shoppingItemField.isNew();

    ShoppingItemFieldModelImpl shoppingItemFieldModelImpl =
        (ShoppingItemFieldModelImpl) shoppingItemField;

    Session session = null;

    try {
      session = openSession();

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

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !ShoppingItemFieldModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    } else {
      if ((shoppingItemFieldModelImpl.getColumnBitmask()
              & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ITEMID.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {Long.valueOf(shoppingItemFieldModelImpl.getOriginalItemId())};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ITEMID, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ITEMID, args);

        args = new Object[] {Long.valueOf(shoppingItemFieldModelImpl.getItemId())};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ITEMID, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ITEMID, args);
      }
    }

    EntityCacheUtil.putResult(
        ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED,
        ShoppingItemFieldImpl.class,
        shoppingItemField.getPrimaryKey(),
        shoppingItemField);

    return shoppingItemField;
  }
  @Override
  public UserTrackerPath updateImpl(UserTrackerPath userTrackerPath) {
    userTrackerPath = toUnwrappedModel(userTrackerPath);

    boolean isNew = userTrackerPath.isNew();

    UserTrackerPathModelImpl userTrackerPathModelImpl = (UserTrackerPathModelImpl) userTrackerPath;

    Session session = null;

    try {
      session = openSession();

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

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !UserTrackerPathModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    } else {
      if ((userTrackerPathModelImpl.getColumnBitmask()
              & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERTRACKERID.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {userTrackerPathModelImpl.getOriginalUserTrackerId()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERTRACKERID, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERTRACKERID, args);

        args = new Object[] {userTrackerPathModelImpl.getUserTrackerId()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERTRACKERID, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERTRACKERID, args);
      }
    }

    EntityCacheUtil.putResult(
        UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
        UserTrackerPathImpl.class,
        userTrackerPath.getPrimaryKey(),
        userTrackerPath,
        false);

    userTrackerPath.resetOriginalValues();

    return userTrackerPath;
  }
  @Override
  public EmpPersonalDetails updateImpl(
      com.rknowsys.eapp.hrm.model.EmpPersonalDetails empPersonalDetails) throws SystemException {
    empPersonalDetails = toUnwrappedModel(empPersonalDetails);

    boolean isNew = empPersonalDetails.isNew();

    EmpPersonalDetailsModelImpl empPersonalDetailsModelImpl =
        (EmpPersonalDetailsModelImpl) empPersonalDetails;

    Session session = null;

    try {
      session = openSession();

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

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !EmpPersonalDetailsModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    } else {
      if ((empPersonalDetailsModelImpl.getColumnBitmask()
              & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_EMPLOYEEID.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {empPersonalDetailsModelImpl.getOriginalEmployeeId()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_EMPLOYEEID, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_EMPLOYEEID, args);

        args = new Object[] {empPersonalDetailsModelImpl.getEmployeeId()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_EMPLOYEEID, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_EMPLOYEEID, args);
      }
    }

    EntityCacheUtil.putResult(
        EmpPersonalDetailsModelImpl.ENTITY_CACHE_ENABLED,
        EmpPersonalDetailsImpl.class,
        empPersonalDetails.getPrimaryKey(),
        empPersonalDetails);

    return empPersonalDetails;
  }
  @Override
  public OrgLabor updateImpl(com.liferay.portal.model.OrgLabor orgLabor) throws SystemException {
    orgLabor = toUnwrappedModel(orgLabor);

    boolean isNew = orgLabor.isNew();

    OrgLaborModelImpl orgLaborModelImpl = (OrgLaborModelImpl) orgLabor;

    Session session = null;

    try {
      session = openSession();

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

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !OrgLaborModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    } else {
      if ((orgLaborModelImpl.getColumnBitmask()
              & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ORGANIZATIONID.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {Long.valueOf(orgLaborModelImpl.getOriginalOrganizationId())};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ORGANIZATIONID, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ORGANIZATIONID, args);

        args = new Object[] {Long.valueOf(orgLaborModelImpl.getOrganizationId())};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ORGANIZATIONID, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ORGANIZATIONID, args);
      }
    }

    EntityCacheUtil.putResult(
        OrgLaborModelImpl.ENTITY_CACHE_ENABLED,
        OrgLaborImpl.class,
        orgLabor.getPrimaryKey(),
        orgLabor);

    return orgLabor;
  }
  @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 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;
  }
  @Override
  public Bar updateImpl(com.liferay.testtransaction.model.Bar bar) {
    bar = toUnwrappedModel(bar);

    boolean isNew = bar.isNew();

    BarModelImpl barModelImpl = (BarModelImpl) bar;

    Session session = null;

    try {
      session = openSession();

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

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !BarModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    } else {
      if ((barModelImpl.getColumnBitmask()
              & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TEXT.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {barModelImpl.getOriginalText()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TEXT, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TEXT, args);

        args = new Object[] {barModelImpl.getText()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TEXT, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TEXT, args);
      }
    }

    EntityCacheUtil.putResult(
        BarModelImpl.ENTITY_CACHE_ENABLED, BarImpl.class, bar.getPrimaryKey(), bar, false);

    bar.resetOriginalValues();

    return bar;
  }
  @Override
  public PanicButton updateImpl(com.ese.ils.beta.model.PanicButton panicButton, boolean merge)
      throws SystemException {
    panicButton = toUnwrappedModel(panicButton);

    boolean isNew = panicButton.isNew();

    PanicButtonModelImpl panicButtonModelImpl = (PanicButtonModelImpl) panicButton;

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, panicButton, merge);

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !PanicButtonModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    } else {
      if ((panicButtonModelImpl.getColumnBitmask()
              & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_BYMODULE.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {Long.valueOf(panicButtonModelImpl.getOriginalModuleId())};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_BYMODULE, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_BYMODULE, args);

        args = new Object[] {Long.valueOf(panicButtonModelImpl.getModuleId())};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_BYMODULE, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_BYMODULE, args);
      }
    }

    EntityCacheUtil.putResult(
        PanicButtonModelImpl.ENTITY_CACHE_ENABLED,
        PanicButtonImpl.class,
        panicButton.getPrimaryKey(),
        panicButton);

    return panicButton;
  }
  @Override
  public Task updateImpl(com.rivetlogic.portlet.todo.model.Task task) throws SystemException {
    task = toUnwrappedModel(task);

    boolean isNew = task.isNew();

    TaskModelImpl taskModelImpl = (TaskModelImpl) task;

    Session session = null;

    try {
      session = openSession();

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

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !TaskModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    } else {
      if ((taskModelImpl.getColumnBitmask()
              & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {taskModelImpl.getOriginalUserId()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID, args);

        args = new Object[] {taskModelImpl.getUserId()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID, args);
      }
    }

    EntityCacheUtil.putResult(
        TaskModelImpl.ENTITY_CACHE_ENABLED, TaskImpl.class, task.getPrimaryKey(), task);

    return task;
  }
  @Override
  public Advertising updateImpl(com.pinsightmedia.sb.model.Advertising advertising, boolean merge)
      throws SystemException {
    advertising = toUnwrappedModel(advertising);

    boolean isNew = advertising.isNew();

    AdvertisingModelImpl advertisingModelImpl = (AdvertisingModelImpl) advertising;

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, advertising, merge);

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !AdvertisingModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    } else {
      if ((advertisingModelImpl.getColumnBitmask()
              & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {Long.valueOf(advertisingModelImpl.getOriginalUserId())};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID, args);

        args = new Object[] {Long.valueOf(advertisingModelImpl.getUserId())};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID, args);
      }
    }

    EntityCacheUtil.putResult(
        AdvertisingModelImpl.ENTITY_CACHE_ENABLED,
        AdvertisingImpl.class,
        advertising.getPrimaryKey(),
        advertising);

    return advertising;
  }
  protected void clearUniqueFindersCache(Shard shard) {
    ShardModelImpl shardModelImpl = (ShardModelImpl) shard;

    Object[] args = new Object[] {shard.getName()};

    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_NAME, args);
    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_NAME, args);

    if ((shardModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_NAME.getColumnBitmask()) != 0) {
      args = new Object[] {shardModelImpl.getOriginalName()};

      FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_NAME, args);
      FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_NAME, args);
    }

    args = new Object[] {shard.getClassNameId(), shard.getClassPK()};

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

    if ((shardModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_C_C.getColumnBitmask()) != 0) {
      args =
          new Object[] {
            shardModelImpl.getOriginalClassNameId(), shardModelImpl.getOriginalClassPK()
          };

      FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
      FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C, args);
    }
  }
  protected void clearUniqueFindersCache(SVNRepository svnRepository) {
    SVNRepositoryModelImpl svnRepositoryModelImpl = (SVNRepositoryModelImpl) svnRepository;

    Object[] args = new Object[] {svnRepository.getUrl()};

    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_URL, args);
    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_URL, args);

    if ((svnRepositoryModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_URL.getColumnBitmask())
        != 0) {
      args = new Object[] {svnRepositoryModelImpl.getOriginalUrl()};

      FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_URL, args);
      FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_URL, args);
    }
  }
  @Override
  protected JIRAChangeItem removeImpl(JIRAChangeItem jiraChangeItem) throws SystemException {
    jiraChangeItem = toUnwrappedModel(jiraChangeItem);

    Session session = null;

    try {
      session = openSession();

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

    FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL, FINDER_ARGS_EMPTY);

    EntityCacheUtil.removeResult(
        JIRAChangeItemModelImpl.ENTITY_CACHE_ENABLED,
        JIRAChangeItemImpl.class,
        jiraChangeItem.getPrimaryKey());

    return jiraChangeItem;
  }
  @Override
  protected ExpandoRow removeImpl(ExpandoRow expandoRow) throws SystemException {
    expandoRow = toUnwrappedModel(expandoRow);

    Session session = null;

    try {
      session = openSession();

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

    ExpandoRowModelImpl expandoRowModelImpl = (ExpandoRowModelImpl) expandoRow;

    FinderCacheUtil.removeResult(
        FINDER_PATH_FETCH_BY_T_C,
        new Object[] {
          Long.valueOf(expandoRowModelImpl.getTableId()),
          Long.valueOf(expandoRowModelImpl.getClassPK())
        });

    EntityCacheUtil.removeResult(
        ExpandoRowModelImpl.ENTITY_CACHE_ENABLED, ExpandoRowImpl.class, expandoRow.getPrimaryKey());

    return expandoRow;
  }
  @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;
  }
  protected void clearUniqueFindersCache(DLSync dlSync) {
    DLSyncModelImpl dlSyncModelImpl = (DLSyncModelImpl) dlSync;

    Object[] args = new Object[] {dlSync.getFileId()};

    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_FILEID, args);
    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FILEID, args);

    if ((dlSyncModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_FILEID.getColumnBitmask())
        != 0) {
      args = new Object[] {dlSyncModelImpl.getOriginalFileId()};

      FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_FILEID, args);
      FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FILEID, args);
    }
  }
  @Override
  protected HRProject removeImpl(HRProject hrProject) throws SystemException {
    hrProject = toUnwrappedModel(hrProject);

    Session session = null;

    try {
      session = openSession();

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

    FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL, FINDER_ARGS_EMPTY);

    EntityCacheUtil.removeResult(
        HRProjectModelImpl.ENTITY_CACHE_ENABLED, HRProjectImpl.class, hrProject.getPrimaryKey());

    return hrProject;
  }
  /**
   * Clears the cache for the h r project.
   *
   * <p>The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link
   * com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
   */
  @Override
  public void clearCache(HRProject hrProject) {
    EntityCacheUtil.removeResult(
        HRProjectModelImpl.ENTITY_CACHE_ENABLED, HRProjectImpl.class, hrProject.getPrimaryKey());

    FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL, FINDER_ARGS_EMPTY);
  }
 protected void clearUniqueFindersCache(WebDAVProps webDAVProps) {
   FinderCacheUtil.removeResult(
       FINDER_PATH_FETCH_BY_C_C,
       new Object[] {
         Long.valueOf(webDAVProps.getClassNameId()), Long.valueOf(webDAVProps.getClassPK())
       });
 }
  /**
   * Returns the number of projects entries.
   *
   * @return the number of projects entries
   * @throws SystemException if a system exception occurred
   */
  @Override
  public int countAll() throws SystemException {
    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY, this);

    if (count == null) {
      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(_SQL_COUNT_PROJECTSENTRY);

        count = (Long) q.uniqueResult();

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY, count);
      } catch (Exception e) {
        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY);

        throw processException(e);
      } finally {
        closeSession(session);
      }
    }

    return count.intValue();
  }
  protected void clearUniqueFindersCache(ListType listType) {
    ListTypeModelImpl listTypeModelImpl = (ListTypeModelImpl) listType;

    Object[] args = new Object[] {listType.getName(), listType.getType()};

    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_N_T, args);
    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_N_T, args);

    if ((listTypeModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_N_T.getColumnBitmask()) != 0) {
      args =
          new Object[] {listTypeModelImpl.getOriginalName(), listTypeModelImpl.getOriginalType()};

      FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_N_T, args);
      FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_N_T, args);
    }
  }
  protected void clearUniqueFindersCache(DLSyncEvent dlSyncEvent) {
    DLSyncEventModelImpl dlSyncEventModelImpl = (DLSyncEventModelImpl) dlSyncEvent;

    Object[] args = new Object[] {dlSyncEvent.getTypePK()};

    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TYPEPK, args);
    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_TYPEPK, args);

    if ((dlSyncEventModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_TYPEPK.getColumnBitmask())
        != 0) {
      args = new Object[] {dlSyncEventModelImpl.getOriginalTypePK()};

      FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TYPEPK, args);
      FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_TYPEPK, args);
    }
  }
  /**
   * Clears the cache for the asset.
   *
   * <p>The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link
   * com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
   */
  @Override
  public void clearCache(Asset asset) {
    EntityCacheUtil.removeResult(
        AssetModelImpl.ENTITY_CACHE_ENABLED, AssetImpl.class, asset.getPrimaryKey());

    FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL, FINDER_ARGS_EMPTY);
  }
  @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;
  }