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

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, jiraChangeItem, merge);

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

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

    return jiraChangeItem;
  }
  @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;
  }
  /**
   * Adds the j i r a change item to the database. Also notifies the appropriate model listeners.
   *
   * @param jiraChangeItem the j i r a change item
   * @return the j i r a change item that was added
   */
  @Indexable(type = IndexableType.REINDEX)
  @Override
  public JIRAChangeItem addJIRAChangeItem(JIRAChangeItem jiraChangeItem) {
    jiraChangeItem.setNew(true);

    return jiraChangeItemPersistence.update(jiraChangeItem);
  }
  /**
   * Creates a new j i r a change item with the primary key. Does not add the j i r a change item to
   * the database.
   *
   * @param jiraChangeItemId the primary key for the new j i r a change item
   * @return the new j i r a change item
   */
  public JIRAChangeItem create(long jiraChangeItemId) {
    JIRAChangeItem jiraChangeItem = new JIRAChangeItemImpl();

    jiraChangeItem.setNew(true);
    jiraChangeItem.setPrimaryKey(jiraChangeItemId);

    return jiraChangeItem;
  }