@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
  public Counter updateImpl(com.liferay.counter.model.Counter counter) throws SystemException {
    counter = toUnwrappedModel(counter);

    boolean isNew = counter.isNew();

    Session session = null;

    try {
      session = openSession();

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

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    }

    EntityCacheUtil.putResult(
        CounterModelImpl.ENTITY_CACHE_ENABLED, CounterImpl.class, counter.getPrimaryKey(), counter);

    return counter;
  }
  /**
   * Returns the number of social equity histories.
   *
   * @return the number of social equity histories
   * @throws SystemException if a system exception occurred
   */
  public int countAll() throws SystemException {
    Object[] finderArgs = new Object[0];

    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL, finderArgs, this);

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

      try {
        session = openSession();

        Query q = session.createQuery(_SQL_COUNT_SOCIALEQUITYHISTORY);

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
  /**
   * 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 cacheUniqueFindersCache(TipsOfTheDayUsers tipsOfTheDayUsers) {
    if (tipsOfTheDayUsers.isNew()) {
      Object[] args =
          new Object[] {
            tipsOfTheDayUsers.getCompanyId(),
            tipsOfTheDayUsers.getGroupId(),
            tipsOfTheDayUsers.getUserId()
          };

      FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_G_U, args, Long.valueOf(1));
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_G_U, args, tipsOfTheDayUsers);
    } else {
      TipsOfTheDayUsersModelImpl tipsOfTheDayUsersModelImpl =
          (TipsOfTheDayUsersModelImpl) tipsOfTheDayUsers;

      if ((tipsOfTheDayUsersModelImpl.getColumnBitmask()
              & FINDER_PATH_FETCH_BY_C_G_U.getColumnBitmask())
          != 0) {
        Object[] args =
            new Object[] {
              tipsOfTheDayUsers.getCompanyId(),
              tipsOfTheDayUsers.getGroupId(),
              tipsOfTheDayUsers.getUserId()
            };

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_G_U, args, Long.valueOf(1));
        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_G_U, args, tipsOfTheDayUsers);
      }
    }
  }
  @Override
  public Account updateImpl(com.liferay.portal.model.Account account) throws SystemException {
    account = toUnwrappedModel(account);

    boolean isNew = account.isNew();

    Session session = null;

    try {
      session = openSession();

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

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    }

    EntityCacheUtil.putResult(
        AccountModelImpl.ENTITY_CACHE_ENABLED, AccountImpl.class, account.getPrimaryKey(), account);

    return account;
  }
  @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
  public Image updateImpl(com.liferay.portal.model.Image image) throws SystemException {
    image = toUnwrappedModel(image);

    boolean isNew = image.isNew();

    Session session = null;

    try {
      session = openSession();

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

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

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

    EntityCacheUtil.putResult(
        ImageModelImpl.ENTITY_CACHE_ENABLED, ImageImpl.class, image.getPrimaryKey(), image);

    return image;
  }
  @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;
  }
  public int countAll() throws SystemException {
    Object[] finderArgs = new Object[0];

    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL, finderArgs, this);

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

      try {
        session = openSession();

        Query q =
            session.createQuery(
                "SELECT COUNT(*) FROM larion.progate.cds.model.ViewListTitleCompetencies");

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
  @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
  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
  public iProject updateImpl(com.asu.poly.iProjects.model.iProject iProject, boolean merge)
      throws SystemException {
    iProject = toUnwrappedModel(iProject);

    boolean isNew = iProject.isNew();

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, iProject, merge);

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    }

    EntityCacheUtil.putResult(
        iProjectModelImpl.ENTITY_CACHE_ENABLED,
        iProjectImpl.class,
        iProject.getPrimaryKey(),
        iProject);

    return iProject;
  }
  @Override
  public Faculty updateImpl(
      com.asu.poly.teams.manualSelect.slayer.model.Faculty faculty, boolean merge)
      throws SystemException {
    faculty = toUnwrappedModel(faculty);

    boolean isNew = faculty.isNew();

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, faculty, merge);

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    }

    EntityCacheUtil.putResult(
        FacultyModelImpl.ENTITY_CACHE_ENABLED, FacultyImpl.class, faculty.getPrimaryKey(), faculty);

    return faculty;
  }
  /**
   * Returns the number of class names.
   *
   * @return the number of class names
   * @throws SystemException if a system exception occurred
   */
  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_CLASSNAME);

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
  public int countAll() throws SystemException {
    Object[] finderArgs = new Object[0];

    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL, finderArgs, this);

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

      try {
        session = openSession();

        Query q =
            session.createQuery(
                "SELECT COUNT(*) FROM com.ext.portlet.debaterevision.model.DebateItemReference");

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
  @Override
  protected HROffice removeImpl(HROffice hrOffice) throws SystemException {
    hrOffice = toUnwrappedModel(hrOffice);

    try {
      clearHRHolidaies.clear(hrOffice.getPrimaryKey());
    } catch (Exception e) {
      throw processException(e);
    } finally {
      FinderCacheUtil.clearCache(HROfficeModelImpl.MAPPING_TABLE_HRHOLIDAYS_HROFFICES_NAME);
    }

    Session session = null;

    try {
      session = openSession();

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

    EntityCacheUtil.removeResult(
        HROfficeModelImpl.ENTITY_CACHE_ENABLED, HROfficeImpl.class, hrOffice.getPrimaryKey());

    return hrOffice;
  }
  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);
    }
  }
  /**
   * Returns an ordered range of all the layout sets where groupId = ?.
   *
   * <p>Useful when paginating results. Returns a maximum of <code>end - start</code> instances.
   * <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result
   * set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start
   * </code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}
   * will return the full result set.
   *
   * @param groupId the group ID
   * @param start the lower bound of the range of layout sets
   * @param end the upper bound of the range of layout sets (not inclusive)
   * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
   * @return the ordered range of matching layout sets
   * @throws SystemException if a system exception occurred
   */
  public List<LayoutSet> findByGroupId(
      long groupId, int start, int end, OrderByComparator orderByComparator)
      throws SystemException {
    Object[] finderArgs =
        new Object[] {
          groupId, String.valueOf(start), String.valueOf(end), String.valueOf(orderByComparator)
        };

    List<LayoutSet> list =
        (List<LayoutSet>) FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID, finderArgs, this);

    if (list == null) {
      StringBundler query = null;

      if (orderByComparator != null) {
        query = new StringBundler(3 + (orderByComparator.getOrderByFields().length * 3));
      } else {
        query = new StringBundler(2);
      }

      query.append(_SQL_SELECT_LAYOUTSET_WHERE);

      query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);

      if (orderByComparator != null) {
        appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator);
      }

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(groupId);

        list = (List<LayoutSet>) QueryUtil.list(q, getDialect(), start, end);
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (list == null) {
          FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_GROUPID, finderArgs);
        } else {
          cacheResult(list);

          FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID, finderArgs, list);
        }

        closeSession(session);
      }
    }

    return list;
  }
  /**
   * Clears the cache for the faculty.
   *
   * <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(Faculty faculty) {
    EntityCacheUtil.removeResult(
        FacultyModelImpl.ENTITY_CACHE_ENABLED, FacultyImpl.class, faculty.getPrimaryKey());

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
  }
  /**
   * Clears the cache for the bar.
   *
   * <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(Bar bar) {
    EntityCacheUtil.removeResult(
        BarModelImpl.ENTITY_CACHE_ENABLED, BarImpl.class, bar.getPrimaryKey());

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
  }
  /**
   * Clears the cache for the i 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(iProject iProject) {
    EntityCacheUtil.removeResult(
        iProjectModelImpl.ENTITY_CACHE_ENABLED, iProjectImpl.class, iProject.getPrimaryKey());

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
  }
Example #23
0
  /**
   * Clears the cache for the list type.
   *
   * <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(ListType listType) {
    EntityCacheUtil.removeResult(
        ListTypeModelImpl.ENTITY_CACHE_ENABLED, ListTypeImpl.class, listType.getPrimaryKey());

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
  }
  /**
   * Clears the cache for all list types.
   *
   * <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() {
    EntityCacheUtil.clearCache(ListTypeImpl.class);

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
  }
  public List<ViewListTitleCompetencies> findByTitleId(
      int titleId, int start, int end, OrderByComparator obc) throws SystemException {
    Object[] finderArgs =
        new Object[] {
          new Integer(titleId), String.valueOf(start), String.valueOf(end), String.valueOf(obc)
        };

    List<ViewListTitleCompetencies> list =
        (List<ViewListTitleCompetencies>)
            FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_TITLEID, finderArgs, this);

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

      try {
        session = openSession();

        StringBuilder query = new StringBuilder();

        query.append("FROM larion.progate.cds.model.ViewListTitleCompetencies WHERE ");

        query.append("title_id = ?");

        query.append(" ");

        if (obc != null) {
          query.append("ORDER BY ");
          query.append(obc.getOrderBy());
        } else {
          query.append("ORDER BY ");

          query.append("competency_number_order ASC");
        }

        Query q = session.createQuery(query.toString());

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(titleId);

        list = (List<ViewListTitleCompetencies>) QueryUtil.list(q, getDialect(), start, end);
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (list == null) {
          list = new ArrayList<ViewListTitleCompetencies>();
        }

        cacheResult(list);

        FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_TITLEID, finderArgs, list);

        closeSession(session);
      }
    }

    return list;
  }
  /**
   * Returns an ordered range of all the social equity histories.
   *
   * <p>Useful when paginating results. Returns a maximum of <code>end - start</code> instances.
   * <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result
   * set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start
   * </code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}
   * will return the full result set.
   *
   * @param start the lower bound of the range of social equity histories
   * @param end the upper bound of the range of social equity histories (not inclusive)
   * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
   * @return the ordered range of social equity histories
   * @throws SystemException if a system exception occurred
   */
  public List<SocialEquityHistory> findAll(int start, int end, OrderByComparator orderByComparator)
      throws SystemException {
    Object[] finderArgs =
        new Object[] {
          String.valueOf(start), String.valueOf(end), String.valueOf(orderByComparator)
        };

    List<SocialEquityHistory> list =
        (List<SocialEquityHistory>)
            FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL, finderArgs, this);

    if (list == null) {
      StringBundler query = null;
      String sql = null;

      if (orderByComparator != null) {
        query = new StringBundler(2 + (orderByComparator.getOrderByFields().length * 3));

        query.append(_SQL_SELECT_SOCIALEQUITYHISTORY);

        appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator);

        sql = query.toString();
      } else {
        sql = _SQL_SELECT_SOCIALEQUITYHISTORY;
      }

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        if (orderByComparator == null) {
          list = (List<SocialEquityHistory>) QueryUtil.list(q, getDialect(), start, end, false);

          Collections.sort(list);
        } else {
          list = (List<SocialEquityHistory>) QueryUtil.list(q, getDialect(), start, end);
        }
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (list == null) {
          FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL, finderArgs);
        } else {
          cacheResult(list);

          FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
        }

        closeSession(session);
      }
    }

    return list;
  }
  /**
   * Returns the number of entries where userId = &#63; and emailAddress = &#63;.
   *
   * @param userId the user ID
   * @param emailAddress the email address
   * @return the number of matching entries
   * @throws SystemException if a system exception occurred
   */
  @Override
  public int countByU_EA(long userId, String emailAddress) throws SystemException {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_U_EA;

    Object[] finderArgs = new Object[] {userId, emailAddress};

    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(3);

      query.append(_SQL_COUNT_ENTRY_WHERE);

      query.append(_FINDER_COLUMN_U_EA_USERID_2);

      boolean bindEmailAddress = false;

      if (emailAddress == null) {
        query.append(_FINDER_COLUMN_U_EA_EMAILADDRESS_1);
      } else if (emailAddress.equals(StringPool.BLANK)) {
        query.append(_FINDER_COLUMN_U_EA_EMAILADDRESS_3);
      } else {
        bindEmailAddress = true;

        query.append(_FINDER_COLUMN_U_EA_EMAILADDRESS_2);
      }

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(userId);

        if (bindEmailAddress) {
          qPos.add(emailAddress);
        }

        count = (Long) q.uniqueResult();

        FinderCacheUtil.putResult(finderPath, finderArgs, count);
      } catch (Exception e) {
        FinderCacheUtil.removeResult(finderPath, finderArgs);

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

    return count.intValue();
  }
  /**
   * 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 ExpandoRow updateImpl(
      com.liferay.portlet.expando.model.ExpandoRow expandoRow, boolean merge)
      throws SystemException {
    expandoRow = toUnwrappedModel(expandoRow);

    boolean isNew = expandoRow.isNew();

    ExpandoRowModelImpl expandoRowModelImpl = (ExpandoRowModelImpl) expandoRow;

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, expandoRow, merge);

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

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

    if (!isNew
        && ((expandoRow.getTableId() != expandoRowModelImpl.getOriginalTableId())
            || (expandoRow.getClassPK() != expandoRowModelImpl.getOriginalClassPK()))) {
      FinderCacheUtil.removeResult(
          FINDER_PATH_FETCH_BY_T_C,
          new Object[] {
            Long.valueOf(expandoRowModelImpl.getOriginalTableId()),
            Long.valueOf(expandoRowModelImpl.getOriginalClassPK())
          });
    }

    if (isNew
        || ((expandoRow.getTableId() != expandoRowModelImpl.getOriginalTableId())
            || (expandoRow.getClassPK() != expandoRowModelImpl.getOriginalClassPK()))) {
      FinderCacheUtil.putResult(
          FINDER_PATH_FETCH_BY_T_C,
          new Object[] {
            Long.valueOf(expandoRow.getTableId()), Long.valueOf(expandoRow.getClassPK())
          },
          expandoRow);
    }

    return expandoRow;
  }
  /**
   * Clears the cache for the class name.
   *
   * <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(ClassName className) {
    EntityCacheUtil.removeResult(
        ClassNameModelImpl.ENTITY_CACHE_ENABLED, ClassNameImpl.class, className.getPrimaryKey());

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);

    clearUniqueFindersCache(className);
  }