@Override
  public Ticket updateImpl(com.liferay.portal.model.Ticket ticket, boolean merge)
      throws SystemException {
    ticket = toUnwrappedModel(ticket);

    boolean isNew = ticket.isNew();

    TicketModelImpl ticketModelImpl = (TicketModelImpl) ticket;

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, ticket, merge);

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

    EntityCacheUtil.putResult(
        TicketModelImpl.ENTITY_CACHE_ENABLED, TicketImpl.class, ticket.getPrimaryKey(), ticket);

    if (!isNew && (!Validator.equals(ticket.getKey(), ticketModelImpl.getOriginalKey()))) {
      FinderCacheUtil.removeResult(
          FINDER_PATH_FETCH_BY_KEY, new Object[] {ticketModelImpl.getOriginalKey()});
    }

    if (isNew || (!Validator.equals(ticket.getKey(), ticketModelImpl.getOriginalKey()))) {
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_KEY, new Object[] {ticket.getKey()}, ticket);
    }

    return ticket;
  }
  @Override
  public Ticket updateImpl(com.liferay.portal.model.Ticket ticket, boolean merge)
      throws SystemException {
    ticket = toUnwrappedModel(ticket);

    boolean isNew = ticket.isNew();

    TicketModelImpl ticketModelImpl = (TicketModelImpl) ticket;

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, ticket, merge);

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

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

    EntityCacheUtil.putResult(
        TicketModelImpl.ENTITY_CACHE_ENABLED, TicketImpl.class, ticket.getPrimaryKey(), ticket);

    if (isNew) {
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_KEY, new Object[] {ticket.getKey()}, ticket);
    } else {
      if ((ticketModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_KEY.getColumnBitmask()) != 0) {
        Object[] args = new Object[] {ticketModelImpl.getOriginalKey()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_KEY, args);
        FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_KEY, args);

        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_KEY, new Object[] {ticket.getKey()}, ticket);
      }
    }

    return ticket;
  }