@Override
  public HRProject updateImpl(com.liferay.hr.model.HRProject hrProject, boolean merge)
      throws SystemException {
    hrProject = toUnwrappedModel(hrProject);

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, hrProject, merge);

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

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

    return hrProject;
  }
  @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);
  }
  /**
   * Caches the h r project in the entity cache if it is enabled.
   *
   * @param hrProject the h r project
   */
  public void cacheResult(HRProject hrProject) {
    EntityCacheUtil.putResult(
        HRProjectModelImpl.ENTITY_CACHE_ENABLED,
        HRProjectImpl.class,
        hrProject.getPrimaryKey(),
        hrProject);

    hrProject.resetOriginalValues();
  }
 /**
  * Caches the h r projects in the entity cache if it is enabled.
  *
  * @param hrProjects the h r projects
  */
 public void cacheResult(List<HRProject> hrProjects) {
   for (HRProject hrProject : hrProjects) {
     if (EntityCacheUtil.getResult(
             HRProjectModelImpl.ENTITY_CACHE_ENABLED,
             HRProjectImpl.class,
             hrProject.getPrimaryKey())
         == null) {
       cacheResult(hrProject);
     }
   }
 }
  public int compareTo(HRProject hrProject) {
    long primaryKey = hrProject.getPrimaryKey();

    if (getPrimaryKey() < primaryKey) {
      return -1;
    } else if (getPrimaryKey() > primaryKey) {
      return 1;
    } else {
      return 0;
    }
  }
  @Override
  public boolean equals(Object obj) {
    if (obj == null) {
      return false;
    }

    HRProject hrProject = null;

    try {
      hrProject = (HRProject) obj;
    } catch (ClassCastException cce) {
      return false;
    }

    long primaryKey = hrProject.getPrimaryKey();

    if (getPrimaryKey() == primaryKey) {
      return true;
    } else {
      return false;
    }
  }
  protected HRProject toUnwrappedModel(HRProject hrProject) {
    if (hrProject instanceof HRProjectImpl) {
      return hrProject;
    }

    HRProjectImpl hrProjectImpl = new HRProjectImpl();

    hrProjectImpl.setNew(hrProject.isNew());
    hrProjectImpl.setPrimaryKey(hrProject.getPrimaryKey());

    hrProjectImpl.setHrProjectId(hrProject.getHrProjectId());
    hrProjectImpl.setGroupId(hrProject.getGroupId());
    hrProjectImpl.setCompanyId(hrProject.getCompanyId());
    hrProjectImpl.setUserId(hrProject.getUserId());
    hrProjectImpl.setUserName(hrProject.getUserName());
    hrProjectImpl.setCreateDate(hrProject.getCreateDate());
    hrProjectImpl.setModifiedDate(hrProject.getModifiedDate());
    hrProjectImpl.setHrClientId(hrProject.getHrClientId());
    hrProjectImpl.setHrProjectStatusId(hrProject.getHrProjectStatusId());
    hrProjectImpl.setName(hrProject.getName());
    hrProjectImpl.setDescription(hrProject.getDescription());
    hrProjectImpl.setEstimatedStartDate(hrProject.getEstimatedStartDate());
    hrProjectImpl.setEstimatedEndDate(hrProject.getEstimatedEndDate());
    hrProjectImpl.setEstimatedHours(hrProject.getEstimatedHours());
    hrProjectImpl.setEstimatedHoursCost(hrProject.getEstimatedHoursCost());
    hrProjectImpl.setEstimatedHoursCostCurrencyCode(hrProject.getEstimatedHoursCostCurrencyCode());
    hrProjectImpl.setEstimatedExpenses(hrProject.getEstimatedExpenses());
    hrProjectImpl.setEstimatedExpensesCurrencyCode(hrProject.getEstimatedExpensesCurrencyCode());
    hrProjectImpl.setActualStartDate(hrProject.getActualStartDate());
    hrProjectImpl.setActualEndDate(hrProject.getActualEndDate());
    hrProjectImpl.setActualHours(hrProject.getActualHours());
    hrProjectImpl.setActualHoursCost(hrProject.getActualHoursCost());
    hrProjectImpl.setActualHoursCostCurrencyCode(hrProject.getActualHoursCostCurrencyCode());
    hrProjectImpl.setActualExpenses(hrProject.getActualExpenses());
    hrProjectImpl.setActualExpensesCurrencyCode(hrProject.getActualExpensesCurrencyCode());

    return hrProjectImpl;
  }