-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Caching issues with Map properties
PostPosted: Thu Jun 07, 2007 12:11 pm 
Newbie

Joined: Thu Jan 11, 2007 11:24 am
Posts: 7
I have a one-to-many relationship (one Brand has many BrandTexts), and have represented this relationship in Brand's cfg.xml:

Code:
<set name="texts" lazy = "true">
       <key column="brand_id"/>
       <one-to-many class="BrandText"/>
</set>


Because I usually want to access the data in BrandText (columns text_key and text_value) as key-value pairs, I also have a Map element in Brand's cfg.xml:

Code:
<map name="textMap" lazy = "true" inverse = "true"
        table="brand_text"
        schema="dbo"
        order-by="text_key">
   
    <key column="brand_id"/>
    <map-key column="text_key" type="string"/>
    <element column="text_value" type="string"/>   
</map>


Although I'm not sure whether this is the best way to do this, it works OK.

When I add 2nd level caching for Brand and its texts and textMap properties in hibernate.cfg.xml:

Code:
       <class-cache class="Brand" usage = "read-write"/>
       <class-cache class="BrandText" usage = "read-write"/> 
       <collection-cache collection="Brand.texts" usage = "read-write"/>
       <collection-cache collection="Brand.textMap" usage = "read-write"/>


It does all cache OK. However, if I update a BrandText object, although this change gets reflected in the texts Set, the values in the textMap Map continue to have their old, stale values.

Is there any way I can make sure that Brand's textMap Map has its values refreshed when a BrandText object is updated?

Thanks,

Jonny


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.