Hibernate version: 2.1.8
Mapping documents:
I have a bidirectional one-to-one mapping between Group and a GroupRSSChannel realized with many-to-one on the Group and one-to-one + property-ref="group" on the GroupRSSChannel.
The mappings are below:
Code:
<subclass name="GroupRSSChannel" discriminator-value="GROUP">
<one-to-one name="group"
property-ref="rssChannel"
class="Group"
/>
</subclass>
and in Group mapping:
Code:
<many-to-one
name="rssChannel"
class="GroupRSSChannel"
unique="true"
cascade="all"
>
<column name="rss_channel_id" />
</many-to-one>
My problem is that if I make both classes cachable, when I list the groups Hibernate will issue a select from Group for each propertyRef from the GroupRSSChannel. If I remove the bidirectionality (thus the propertyRef statement) everything works as expected, groups come from the query cache, no statement is issued to the DB.
Am I doing something wrong (most probably), or this is the expected behavior (one select from db for each property-ref) the property-ref shouldn't come (or can't be obtained) from the cache ?
Thanks in advance.