1 Reply Latest reply on Jul 27, 2009 4:54 AM by Angus Morison

    Hibernate second level cache with manytomany relationships

    Angus Morison Newbie

      I want to use the Hibernate Second level cache for Entity beans. It works fine with simple Entitys, but in the case of many to many relations (for example the 'Relationships' tutorial) it does not work. I think that, at a Hibernate level, there is an explanation here:
      http://www.javalobby.org/java/forums/t48846.html
      But I can not see how to implement his suggestion at EJB3 level.
      I suppose that what I am looking for is an annotation equivalent of

      <many-to-one name="parent" column="parent_id" class="Person"/>
       <set name="children">
       <key column="parent_id"/>
       <cache usage="read-write"/>
       <one-to-many class="Person"/>
       </set>
      

      Specifically the
      <cache usage="read-write"/>
      bit.

      Can anyone help? Thanks?