-->
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: one-to-one caching not working
PostPosted: Thu Feb 03, 2005 12:31 am 
Newbie

Joined: Thu Jun 17, 2004 1:15 am
Posts: 7
Hibernate version: 2.1.7

I have a class called Client which is mapped with a one-to-one relationship to a class called Budget. Basically, a Client can have a financial budget. This is a PK one-to-one mapping.

Everything executes fine, however, the Budget class is not cached when the Client is loaded, even though the Client object is cached. Both the Client and the Budget class have <cache usage="read-write"/> defined.

I am using ehcache and the ehcache settings are correct. Even if they are not, the default cache settings should be used.

Should I be expecting this behaviour, or should one-to-one PK associations be cached?

Mapping documents:
Code:
<class name="Client" table="CLIENT">
    <cache usage="read-write"/>
   
    <id name="id" type="long" column="CLIENT_SEQ">
        <generator class="sequence">
            <param name="sequence">CLIENT_NUMBER_SEQ</param>
        </generator>
    </id>

    <one-to-one name="budget" class="Budget"/>
</class>

<class name="Budget" table="CLIENT_BUDGET">
    <cache usage="read-write"/>

    <id name="id" column="CLIENT_SEQ">
        <generator class="foreign">
            <param name="property">id</param>
        </generator>
    </id>
</class>


Database tables:
Code:
CLIENT
------
CLIENT_SEQ NUMBER NOT NULL


BUDGET
------
CLIENT_SEQ NUMBER NOT NULL


Thanks,
Ray.


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.