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: Mapping set based on joined-subclass superclass key column
PostPosted: Wed Feb 01, 2006 5:43 pm 
Newbie

Joined: Wed Feb 01, 2006 5:02 pm
Posts: 1
Hello,

I ran into a problem mapping a Set on a joined-subclass where I use a mapping key from its superclass. Here follows an example scenario:

Example mapping:
Code:
   <class name="User">
        <id name="id" type="long" unsaved-value="null" >
            <generator class="increment" />
        </id>
        <property name="username" type="string" />

        <set name="subclassesA" inverse="true">
            <key column="userid" />
            <one-to-many class="SubclassA"/>
        </set>
        <set name="subclassesB" inverse="true">
            <key column="userid" />
            <one-to-many class="SubclassB" />
        </set>
   </class>

   <class name="SuperClass">
        <id name="id" type="long" unsaved-value="null" >
            <generator class="increment" />
        </id>
        <many-to-one name="user" column="userid" class="User"/>           
        .. more properties ..

        <joined-subclass name="SubclassA">
            <key column="id"/>
            .. more properties ..
        </joined-subclass>

        <joined-subclass name="SubclassB">
            <key column="id"/>
            .. more properties ..
        </joined-subclass>
   </class>


Interesting generated query details:
selecting properties,
inner joining SuperClass on SubClass,
and then..
WHERE SubclassA.userid = ?

So basically it seems like hibernate forces the column to be from the Sub class, SubclassA. I was wondering if there's a way to tell hibernate to use a column from the super class, SuperClass.

Anyone with an idea how to get this working?

Version:
Hibernate 3.0.5


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.