3 Replies Latest reply on Oct 15, 2006 10:12 AM by Laszlo Fogas

    can't evict manually entity bean from treecache

    Laszlo Fogas Newbie


      Jboss cache(1.4 sp1) as hibernate 2nd level cache. The cache works fine except I can't evict manually an entity bean from the treecache. Here is the situation:

      First, i obtain a TreecacheMBean instance:

      MBeanServer server = MBeanServerLocator.locate();
      TreeCacheMBean cache;
      try {
      } catch (Exception e) {
      throw new TechnicalException("hiba", e);

        • 1. Re: can't evict manually entity bean from treecache
          Laszlo Fogas Newbie

          ehh submit :)

          so, after i checked that my entity bean is in the cache:


          and yes it's in the cache






          item: CacheEntry(a.b.business.model.Felhasznalok)[...]

          after trying to remove it from the cache:


          but the log says that

          processRemoveNodes(): Can't find node associated with fqn: /a/b/business/model/Felhasznalok/a.b.business.model.Felhasznalok#1Could have been evicted earlier. Will just continue

          I don't understand why!

          if i remove its parent node than works fine, but it would remove all of the objects instance in the cache, and i don't want this behaviour.

          If i put into the cache an object with the same name, it removes that instance using the former mentioned solution.

          Other thing i tried that removing with hibernate:


          it has no effect.

          Am I doing something wrong?

          thanks in advance, lazlo

          • 2. Re: can't evict manually entity bean from treecache
            Brian Stansberry Master

            Opening caveat: trying to manually manage the Hibernate 2nd level cache sounds like asking for problems.

            The session.evict() call in Hibernate works on the session cache, not the 2nd level cache; that's why it has no effect. Check the Hibernate docs to see if there is an equivalent operation user's are meant to perform on the 2nd level cache; if so use that instead of manipulating TreeCache directly.

            If you decide you still want to manipulate the tree cache directly, do you want to call evict() or remove()?

            The log message you quoted is debug logging from the background eviction process that you're manually overriding; why are you concerned about it? It's not telling you that your remove() call didn't work.

            • 3. Re: can't evict manually entity bean from treecache
              Laszlo Fogas Newbie

              sorry, everything works with the sessionFactory.evict() method. (the factory's evict is operates on the 2nd level cache)

              thanks, lazlo