@Override
  protected WebDAVProps removeImpl(WebDAVProps webDAVProps) {
    webDAVProps = toUnwrappedModel(webDAVProps);

    Session session = null;

    try {
      session = openSession();

      if (!session.contains(webDAVProps)) {
        webDAVProps =
            (WebDAVProps) session.get(WebDAVPropsImpl.class, webDAVProps.getPrimaryKeyObj());
      }

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

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

    return webDAVProps;
  }
  @Override
  public Map<Serializable, WebDAVProps> fetchByPrimaryKeys(Set<Serializable> primaryKeys) {
    if (primaryKeys.isEmpty()) {
      return Collections.emptyMap();
    }

    Map<Serializable, WebDAVProps> map = new HashMap<Serializable, WebDAVProps>();

    if (primaryKeys.size() == 1) {
      Iterator<Serializable> iterator = primaryKeys.iterator();

      Serializable primaryKey = iterator.next();

      WebDAVProps webDAVProps = fetchByPrimaryKey(primaryKey);

      if (webDAVProps != null) {
        map.put(primaryKey, webDAVProps);
      }

      return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

    for (Serializable primaryKey : primaryKeys) {
      WebDAVProps webDAVProps =
          (WebDAVProps)
              entityCache.getResult(
                  WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED, WebDAVPropsImpl.class, primaryKey);

      if (webDAVProps == null) {
        if (uncachedPrimaryKeys == null) {
          uncachedPrimaryKeys = new HashSet<Serializable>();
        }

        uncachedPrimaryKeys.add(primaryKey);
      } else {
        map.put(primaryKey, webDAVProps);
      }
    }

    if (uncachedPrimaryKeys == null) {
      return map;
    }

    StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1);

    query.append(_SQL_SELECT_WEBDAVPROPS_WHERE_PKS_IN);

    for (Serializable primaryKey : uncachedPrimaryKeys) {
      query.append(String.valueOf(primaryKey));

      query.append(StringPool.COMMA);
    }

    query.setIndex(query.index() - 1);

    query.append(StringPool.CLOSE_PARENTHESIS);

    String sql = query.toString();

    Session session = null;

    try {
      session = openSession();

      Query q = session.createQuery(sql);

      for (WebDAVProps webDAVProps : (List<WebDAVProps>) q.list()) {
        map.put(webDAVProps.getPrimaryKeyObj(), webDAVProps);

        cacheResult(webDAVProps);

        uncachedPrimaryKeys.remove(webDAVProps.getPrimaryKeyObj());
      }

      for (Serializable primaryKey : uncachedPrimaryKeys) {
        entityCache.putResult(
            WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
            WebDAVPropsImpl.class,
            primaryKey,
            _nullWebDAVProps);
      }
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    return map;
  }