/**
   * Removes the shopping item price with the primary key from the database. Also notifies the
   * appropriate model listeners.
   *
   * @param primaryKey the primary key of the shopping item price
   * @return the shopping item price that was removed
   * @throws NoSuchItemPriceException if a shopping item price with the primary key could not be
   *     found
   */
  @Override
  public ShoppingItemPrice remove(Serializable primaryKey) throws NoSuchItemPriceException {
    Session session = null;

    try {
      session = openSession();

      ShoppingItemPrice shoppingItemPrice =
          (ShoppingItemPrice) session.get(ShoppingItemPriceImpl.class, primaryKey);

      if (shoppingItemPrice == null) {
        if (_log.isDebugEnabled()) {
          _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
        }

        throw new NoSuchItemPriceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
      }

      return remove(shoppingItemPrice);
    } catch (NoSuchItemPriceException nsee) {
      throw nsee;
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }
  }
  /**
   * 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();
  }
  /**
   * Removes the projects entry with the primary key from the database. Also notifies the
   * appropriate model listeners.
   *
   * @param primaryKey the primary key of the projects entry
   * @return the projects entry that was removed
   * @throws com.liferay.so.NoSuchProjectsEntryException if a projects entry with the primary key
   *     could not be found
   * @throws SystemException if a system exception occurred
   */
  @Override
  public ProjectsEntry remove(Serializable primaryKey)
      throws NoSuchProjectsEntryException, SystemException {
    Session session = null;

    try {
      session = openSession();

      ProjectsEntry projectsEntry =
          (ProjectsEntry) session.get(ProjectsEntryImpl.class, primaryKey);

      if (projectsEntry == null) {
        if (_log.isWarnEnabled()) {
          _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
        }

        throw new NoSuchProjectsEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
      }

      return remove(projectsEntry);
    } catch (NoSuchProjectsEntryException nsee) {
      throw nsee;
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }
  }
  /**
   * Removes the bar with the primary key from the database. Also notifies the appropriate model
   * listeners.
   *
   * @param primaryKey the primary key of the bar
   * @return the bar that was removed
   * @throws com.liferay.testtransaction.NoSuchBarException if a bar with the primary key could not
   *     be found
   */
  @Override
  public Bar remove(Serializable primaryKey) throws NoSuchBarException {
    Session session = null;

    try {
      session = openSession();

      Bar bar = (Bar) session.get(BarImpl.class, primaryKey);

      if (bar == null) {
        if (_log.isWarnEnabled()) {
          _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
        }

        throw new NoSuchBarException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
      }

      return remove(bar);
    } catch (NoSuchBarException nsee) {
      throw nsee;
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }
  }
  /**
   * Returns the bar with the primary key or returns <code>null</code> if it could not be found.
   *
   * @param primaryKey the primary key of the bar
   * @return the bar, or <code>null</code> if a bar with the primary key could not be found
   */
  @Override
  public Bar fetchByPrimaryKey(Serializable primaryKey) {
    Bar bar =
        (Bar)
            EntityCacheUtil.getResult(BarModelImpl.ENTITY_CACHE_ENABLED, BarImpl.class, primaryKey);

    if (bar == _nullBar) {
      return null;
    }

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

      try {
        session = openSession();

        bar = (Bar) session.get(BarImpl.class, primaryKey);

        if (bar != null) {
          cacheResult(bar);
        } else {
          EntityCacheUtil.putResult(
              BarModelImpl.ENTITY_CACHE_ENABLED, BarImpl.class, primaryKey, _nullBar);
        }
      } catch (Exception e) {
        EntityCacheUtil.removeResult(BarModelImpl.ENTITY_CACHE_ENABLED, BarImpl.class, primaryKey);

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

    return bar;
  }
  public List<MicroblogsEntry> findByUserId(long userId, int start, int end)
      throws SystemException {

    Session session = null;

    try {
      session = openSession();

      String sql = CustomSQLUtil.get(FIND_BY_USER_ID);

      sql = StringUtil.replace(sql, "[$JOIN_BY_SOCIAL_RELATION$]", _joinBySocialRelationSQL);

      SQLQuery q = session.createSQLQuery(sql);

      q.addEntity("MicroblogsEntry", MicroblogsEntryImpl.class);

      QueryPos qPos = QueryPos.getInstance(q);

      qPos.add(MicroblogsEntryConstants.TYPE_EVERYONE);
      qPos.add(userId);
      qPos.add(userId);
      qPos.add(userId);

      return (List<MicroblogsEntry>) QueryUtil.list(q, getDialect(), start, end);
    } catch (Exception e) {
      throw new SystemException(e);
    } finally {
      closeSession(session);
    }
  }
  /**
   * Removes the shopping item field with the primary key from the database. Also notifies the
   * appropriate model listeners.
   *
   * @param primaryKey the primary key of the shopping item field
   * @return the shopping item field that was removed
   * @throws com.liferay.portlet.shopping.NoSuchItemFieldException if a shopping item field with the
   *     primary key could not be found
   * @throws SystemException if a system exception occurred
   */
  @Override
  public ShoppingItemField remove(Serializable primaryKey)
      throws NoSuchItemFieldException, SystemException {
    Session session = null;

    try {
      session = openSession();

      ShoppingItemField shoppingItemField =
          (ShoppingItemField) session.get(ShoppingItemFieldImpl.class, primaryKey);

      if (shoppingItemField == null) {
        if (_log.isWarnEnabled()) {
          _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
        }

        throw new NoSuchItemFieldException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
      }

      return remove(shoppingItemField);
    } catch (NoSuchItemFieldException nsee) {
      throw nsee;
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }
  }
Пример #8
0
  private CounterHolder _obtainIncrement(String counterName, long range, long size)
      throws SystemException {

    Session session = null;

    try {
      session = openSession();

      Counter counter = (Counter) session.get(CounterImpl.class, counterName, LockMode.UPGRADE);

      long newValue = counter.getCurrentId();

      if (size > newValue) {
        newValue = size;
      }

      long rangeMax = newValue + range;

      counter.setCurrentId(rangeMax);

      CounterHolder counterHolder = new CounterHolder(newValue, rangeMax);

      session.saveOrUpdate(counter);

      session.flush();

      return counterHolder;
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }
  }
  /**
   * Removes the tra cuu thu tuc hanh chinh with the primary key from the database. Also notifies
   * the appropriate model listeners.
   *
   * @param primaryKey the primary key of the tra cuu thu tuc hanh chinh
   * @return the tra cuu thu tuc hanh chinh that was removed
   * @throws org.oep.cmon.dao.touchscreen.NoSuchTraCuuThuTucHanhChinhException if a tra cuu thu tuc
   *     hanh chinh with the primary key could not be found
   * @throws SystemException if a system exception occurred
   */
  @Override
  public TraCuuThuTucHanhChinh remove(Serializable primaryKey)
      throws NoSuchTraCuuThuTucHanhChinhException, SystemException {
    Session session = null;

    try {
      session = openSession();

      TraCuuThuTucHanhChinh traCuuThuTucHanhChinh =
          (TraCuuThuTucHanhChinh) session.get(TraCuuThuTucHanhChinhImpl.class, primaryKey);

      if (traCuuThuTucHanhChinh == null) {
        if (_log.isWarnEnabled()) {
          _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
        }

        throw new NoSuchTraCuuThuTucHanhChinhException(
            _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
      }

      return remove(traCuuThuTucHanhChinh);
    } catch (NoSuchTraCuuThuTucHanhChinhException nsee) {
      throw nsee;
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }
  }
  /**
   * Removes the h r project with the primary key from the database. Also notifies the appropriate
   * model listeners.
   *
   * @param hrProjectId the primary key of the h r project
   * @return the h r project that was removed
   * @throws com.liferay.hr.NoSuchProjectException if a h r project with the primary key could not
   *     be found
   * @throws SystemException if a system exception occurred
   */
  public HRProject remove(long hrProjectId) throws NoSuchProjectException, SystemException {
    Session session = null;

    try {
      session = openSession();

      HRProject hrProject = (HRProject) session.get(HRProjectImpl.class, Long.valueOf(hrProjectId));

      if (hrProject == null) {
        if (_log.isWarnEnabled()) {
          _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + hrProjectId);
        }

        throw new NoSuchProjectException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + hrProjectId);
      }

      return hrProjectPersistence.remove(hrProject);
    } catch (NoSuchProjectException nsee) {
      throw nsee;
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }
  }
  @Override
  public List<CalEvent> findByFutureReminders() {
    Calendar calendar = Calendar.getInstance();

    calendar.add(Calendar.HOUR, -24);

    Timestamp calendar_TS = CalendarUtil.getTimestamp(calendar.getTime());

    Session session = null;

    try {
      session = openSession();

      String sql = CustomSQLUtil.get(FIND_BY_FUTURE_REMINDERS);

      SQLQuery q = session.createSynchronizedSQLQuery(sql);

      q.addEntity("CalEvent", CalEventImpl.class);

      QueryPos qPos = QueryPos.getInstance(q);

      qPos.add(CalEventConstants.REMIND_BY_NONE);
      qPos.add(calendar_TS);
      qPos.add(calendar_TS);

      return q.list(true);
    } catch (Exception e) {
      throw new SystemException(e);
    } finally {
      closeSession(session);
    }
  }
  @Override
  public List<JournalArticle> findByReviewDate(
      long classNameId, Date reviewDateLT, Date reviewDateGT) {

    Timestamp reviewDateLT_TS = CalendarUtil.getTimestamp(reviewDateLT);
    Timestamp reviewDateGT_TS = CalendarUtil.getTimestamp(reviewDateGT);

    Session session = null;
    try {
      session = openSession();

      String sql = CustomSQLUtil.get(FIND_BY_REVIEW_DATE);

      SQLQuery q = session.createSynchronizedSQLQuery(sql);

      q.addEntity(JournalArticleImpl.TABLE_NAME, JournalArticleImpl.class);

      QueryPos qPos = QueryPos.getInstance(q);

      qPos.add(classNameId);
      qPos.add(reviewDateGT_TS);
      qPos.add(reviewDateLT_TS);

      return q.list(true);
    } catch (Exception e) {
      throw new SystemException(e);
    } finally {
      closeSession(session);
    }
  }
  @Override
  public List<JournalArticle> findByExpirationDate(
      long classNameId, Date expirationDateLT, QueryDefinition<JournalArticle> queryDefinition) {

    Timestamp expirationDateLT_TS = CalendarUtil.getTimestamp(expirationDateLT);

    Session session = null;

    try {
      session = openSession();

      String sql = CustomSQLUtil.get(FIND_BY_EXPIRATION_DATE, queryDefinition);

      SQLQuery q = session.createSynchronizedSQLQuery(sql);

      q.addEntity(JournalArticleImpl.TABLE_NAME, JournalArticleImpl.class);

      QueryPos qPos = QueryPos.getInstance(q);

      qPos.add(classNameId);
      qPos.add(queryDefinition.getStatus());
      qPos.add(expirationDateLT_TS);

      return q.list(true);
    } catch (Exception e) {
      throw new SystemException(e);
    } finally {
      closeSession(session);
    }
  }
  @Override
  protected ShoppingItemPrice removeImpl(ShoppingItemPrice shoppingItemPrice) {
    shoppingItemPrice = toUnwrappedModel(shoppingItemPrice);

    Session session = null;

    try {
      session = openSession();

      if (!session.contains(shoppingItemPrice)) {
        shoppingItemPrice =
            (ShoppingItemPrice)
                session.get(ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKeyObj());
      }

      if (shoppingItemPrice != null) {
        session.delete(shoppingItemPrice);
      }
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    if (shoppingItemPrice != null) {
      clearCache(shoppingItemPrice);
    }

    return shoppingItemPrice;
  }
  public PmlEdmLevelSend updateImpl(
      com.sgs.portlet.pmllevelsend.model.PmlEdmLevelSend pmlEdmLevelSend, boolean merge)
      throws SystemException {
    Session session = null;

    try {
      session = openSession();

      if (merge) {
        session.merge(pmlEdmLevelSend);
      } else {
        if (pmlEdmLevelSend.isNew()) {
          session.save(pmlEdmLevelSend);
        }
      }

      session.flush();

      pmlEdmLevelSend.setNew(false);

      return pmlEdmLevelSend;
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);

      FinderCacheUtil.clearCache(PmlEdmLevelSend.class.getName());
    }
  }
  @Override
  protected Asset removeImpl(Asset asset) throws SystemException {
    asset = toUnwrappedModel(asset);

    Session session = null;

    try {
      session = openSession();

      if (!session.contains(asset)) {
        asset = (Asset) session.get(AssetImpl.class, asset.getPrimaryKeyObj());
      }

      if (asset != null) {
        session.delete(asset);
      }
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    if (asset != null) {
      clearCache(asset);
    }

    return asset;
  }
  public PmlEdmLevelSend remove(int levelSendId)
      throws NoSuchPmlEdmLevelSendException, SystemException {
    Session session = null;

    try {
      session = openSession();

      PmlEdmLevelSend pmlEdmLevelSend =
          (PmlEdmLevelSend) session.get(PmlEdmLevelSendImpl.class, new Integer(levelSendId));

      if (pmlEdmLevelSend == null) {
        if (_log.isWarnEnabled()) {
          _log.warn("No PmlEdmLevelSend exists with the primary key " + levelSendId);
        }

        throw new NoSuchPmlEdmLevelSendException(
            "No PmlEdmLevelSend exists with the primary key " + levelSendId);
      }

      return remove(pmlEdmLevelSend);
    } catch (NoSuchPmlEdmLevelSendException nsee) {
      throw nsee;
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }
  }
  public List<JIRAAction> findByCD_P(Date createDate, long projectId, int start, int end)
      throws SystemException {

    Timestamp createDate_TS = CalendarUtil.getTimestamp(createDate);

    Session session = null;

    try {
      session = openSession();

      String sql = CustomSQLUtil.get(FIND_BY_CD_P);

      SQLQuery q = session.createSynchronizedSQLQuery(sql);

      q.addEntity("jiraaction", JIRAActionImpl.class);

      QueryPos qPos = QueryPos.getInstance(q);

      qPos.add(projectId);
      qPos.add(createDate_TS);

      return (List<JIRAAction>) QueryUtil.list(q, getDialect(), start, end);
    } catch (Exception e) {
      throw new SystemException(e);
    } finally {
      closeSession(session);
    }
  }
  public List<MicroblogsEntry> findByU_T_MU(
      long userId, int type, long microblogsEntryUserId, int start, int end)
      throws SystemException {

    Session session = null;

    try {
      session = openSession();

      String sql = CustomSQLUtil.get(FIND_BY_U_MU);

      SQLQuery q = session.createSQLQuery(sql);

      q.addEntity("MicroblogsEntry", MicroblogsEntryImpl.class);

      QueryPos qPos = QueryPos.getInstance(q);

      qPos.add(MicroblogsEntryConstants.TYPE_EVERYONE);
      qPos.add(userId);
      qPos.add(type);
      qPos.add(microblogsEntryUserId);

      return (List<MicroblogsEntry>) QueryUtil.list(q, getDialect(), start, end);
    } catch (Exception e) {
      throw new SystemException(e);
    } finally {
      closeSession(session);
    }
  }
  @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 ShoppingItemField removeImpl(ShoppingItemField shoppingItemField)
      throws SystemException {
    shoppingItemField = toUnwrappedModel(shoppingItemField);

    Session session = null;

    try {
      session = openSession();

      if (shoppingItemField.isCachedModel()) {
        shoppingItemField =
            (ShoppingItemField)
                session.get(ShoppingItemFieldImpl.class, shoppingItemField.getPrimaryKeyObj());
      }

      session.delete(shoppingItemField);
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    clearCache(shoppingItemField);

    return shoppingItemField;
  }
  public List<WallEntry> findByG1_G2_U1_U2(
      long groupId1, long groupId2, long userId1, long userId2, int start, int end)
      throws SystemException {

    Session session = null;

    try {
      session = openSession();

      String sql = CustomSQLUtil.get(FIND_BY_G1_G2_U1_U2);

      SQLQuery q = session.createSQLQuery(sql);

      q.addEntity("SN_WallEntry", WallEntryImpl.class);

      QueryPos qPos = QueryPos.getInstance(q);

      qPos.add(groupId1);
      qPos.add(groupId2);
      qPos.add(userId1);
      qPos.add(userId2);

      return (List<WallEntry>) QueryUtil.list(q, getDialect(), start, end);
    } catch (Exception e) {
      throw new SystemException(e);
    } finally {
      closeSession(session);
    }
  }
  @Override
  protected Bar removeImpl(Bar bar) {
    bar = toUnwrappedModel(bar);

    Session session = null;

    try {
      session = openSession();

      if (!session.contains(bar)) {
        bar = (Bar) session.get(BarImpl.class, bar.getPrimaryKeyObj());
      }

      if (bar != null) {
        session.delete(bar);
      }
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    if (bar != null) {
      clearCache(bar);
    }

    return bar;
  }
  @Override
  protected Shard removeImpl(Shard shard) throws SystemException {
    shard = toUnwrappedModel(shard);

    Session session = null;

    try {
      session = openSession();

      if (!session.contains(shard)) {
        shard = (Shard) session.get(ShardImpl.class, shard.getPrimaryKeyObj());
      }

      if (shard != null) {
        session.delete(shard);
      }
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    if (shard != null) {
      clearCache(shard);
    }

    return shard;
  }
  /**
   * Removes the class name with the primary key from the database. Also notifies the appropriate
   * model listeners.
   *
   * @param primaryKey the primary key of the class name
   * @return the class name that was removed
   * @throws com.liferay.portal.NoSuchClassNameException if a class name with the primary key could
   *     not be found
   * @throws SystemException if a system exception occurred
   */
  @Override
  public ClassName remove(Serializable primaryKey)
      throws NoSuchClassNameException, SystemException {
    Session session = null;

    try {
      session = openSession();

      ClassName className = (ClassName) session.get(ClassNameImpl.class, primaryKey);

      if (className == null) {
        if (_log.isWarnEnabled()) {
          _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
        }

        throw new NoSuchClassNameException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
      }

      return remove(className);
    } catch (NoSuchClassNameException nsee) {
      throw nsee;
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }
  }
  /**
   * Removes the ticket with the primary key from the database. Also notifies the appropriate model
   * listeners.
   *
   * @param ticketId the primary key of the ticket
   * @return the ticket that was removed
   * @throws com.liferay.portal.NoSuchTicketException if a ticket with the primary key could not be
   *     found
   * @throws SystemException if a system exception occurred
   */
  public Ticket remove(long ticketId) throws NoSuchTicketException, SystemException {
    Session session = null;

    try {
      session = openSession();

      Ticket ticket = (Ticket) session.get(TicketImpl.class, Long.valueOf(ticketId));

      if (ticket == null) {
        if (_log.isWarnEnabled()) {
          _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + ticketId);
        }

        throw new NoSuchTicketException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + ticketId);
      }

      return ticketPersistence.remove(ticket);
    } catch (NoSuchTicketException nsee) {
      throw nsee;
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }
  }
  /**
   * 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();
  }
Пример #28
0
  @Override
  protected PasswordTracker removeImpl(PasswordTracker passwordTracker) throws SystemException {
    passwordTracker = toUnwrappedModel(passwordTracker);

    Session session = null;

    try {
      session = openSession();

      if (!session.contains(passwordTracker)) {
        passwordTracker =
            (PasswordTracker)
                session.get(PasswordTrackerImpl.class, passwordTracker.getPrimaryKeyObj());
      }

      if (passwordTracker != null) {
        session.delete(passwordTracker);
      }
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    if (passwordTracker != null) {
      clearCache(passwordTracker);
    }

    return passwordTracker;
  }
  @Override
  protected ProjectsEntry removeImpl(ProjectsEntry projectsEntry) throws SystemException {
    projectsEntry = toUnwrappedModel(projectsEntry);

    Session session = null;

    try {
      session = openSession();

      if (!session.contains(projectsEntry)) {
        projectsEntry =
            (ProjectsEntry) session.get(ProjectsEntryImpl.class, projectsEntry.getPrimaryKeyObj());
      }

      if (projectsEntry != null) {
        session.delete(projectsEntry);
      }
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    if (projectsEntry != null) {
      clearCache(projectsEntry);
    }

    return projectsEntry;
  }
  /**
   * Returns the number of shopping item prices.
   *
   * @return the number of shopping item prices
   */
  @Override
  public int countAll() {
    Long count = (Long) finderCache.getResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY, this);

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

      try {
        session = openSession();

        Query q = session.createQuery(_SQL_COUNT_SHOPPINGITEMPRICE);

        count = (Long) q.uniqueResult();

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

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

    return count.intValue();
  }