6 Replies Latest reply on Oct 11, 2006 5:39 PM by Laszlo Fogas

    caching onetomany relation

    Laszlo Fogas Newbie


      I'm using treecache for second level cache:

      <property name="hibernate.cache.provider_class"
      <property name="hibernate.treecache.mbean.object_name"
       value="jboss.cache:service=TreeCache" />
      <property name="hibernate.cache.use_query_cache"
       value="true" />

      I've got an entity with one to many relation defined:

      @Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
      @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "felhasznalok")
      public Set<Kedvencek> getKedvenceks() {
       return this.kedvenceks;

      and also defined caching for collections. The whole caching works fine, except, when i merge the entity with the mapped collection (added a new entry for the onetomany relation collection), the changes appear in the database, but the cache does not update itself.

      With simple entities the cache works fine, and the new values are shown.

      What's the problem?

      regards L