public WeblogEntryData getWeblogEntryByAnchor(WebsiteData website, String anchor)
      throws RollerException {

    if (website == null) throw new RollerException("Website is null");

    if (anchor == null) throw new RollerException("Anchor is null");

    // mapping key is combo of weblog + anchor
    String mappingKey = website.getHandle() + ":" + anchor;

    // check cache first
    // NOTE: if we ever allow changing anchors then this needs updating
    if (this.entryAnchorToIdMap.containsKey(mappingKey)) {

      WeblogEntryData entry = this.getWeblogEntry((String) this.entryAnchorToIdMap.get(mappingKey));
      if (entry != null) {
        log.debug("entryAnchorToIdMap CACHE HIT - " + mappingKey);
        return entry;
      } else {
        // mapping hit with lookup miss?  mapping must be old, remove it
        this.entryAnchorToIdMap.remove(mappingKey);
      }
    }

    // cache failed, do lookup
    try {
      Session session = ((HibernatePersistenceStrategy) this.strategy).getSession();
      Criteria criteria = session.createCriteria(WeblogEntryData.class);
      criteria.add(
          Expression.conjunction()
              .add(Expression.eq("website", website))
              .add(Expression.eq("anchor", anchor)));
      criteria.addOrder(Order.desc("pubTime"));
      criteria.setMaxResults(1);

      List list = criteria.list();

      WeblogEntryData entry = null;
      if (list.size() != 0) {
        entry = (WeblogEntryData) criteria.uniqueResult();
      }

      // add mapping to cache
      if (entry != null) {
        log.debug("entryAnchorToIdMap CACHE MISS - " + mappingKey);
        this.entryAnchorToIdMap.put(mappingKey, entry.getId());
      }

      return entry;
    } catch (HibernateException e) {
      throw new RollerException(e);
    }
  }
  public List getNextPrevEntries(
      WeblogEntryData current, String catName, String locale, int maxEntries, boolean next)
      throws RollerException {

    Junction conjunction = Expression.conjunction();
    conjunction.add(Expression.eq("website", current.getWebsite()));
    conjunction.add(Expression.eq("status", WeblogEntryData.PUBLISHED));

    if (next) {
      conjunction.add(Expression.gt("pubTime", current.getPubTime()));
    } else {
      conjunction.add(Expression.lt("pubTime", current.getPubTime()));
    }

    if (catName != null && !catName.trim().equals("/")) {
      WeblogCategoryData category = getWeblogCategoryByPath(current.getWebsite(), null, catName);
      if (category != null) {
        conjunction.add(Expression.eq("category", category));
      } else {
        throw new RollerException("Cannot find category: " + catName);
      }
    }

    if (locale != null) {
      conjunction.add(Expression.ilike("locale", locale, MatchMode.START));
    }

    try {
      Session session = ((HibernatePersistenceStrategy) this.strategy).getSession();
      Criteria criteria = session.createCriteria(WeblogEntryData.class);
      criteria.addOrder(next ? Order.asc("pubTime") : Order.desc("pubTime"));
      criteria.add(conjunction);
      criteria.setMaxResults(maxEntries);
      List results = criteria.list();
      return results;
    } catch (HibernateException e) {
      throw new RollerException(e);
    }
  }