-->
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.  [ 5 posts ] 
Author Message
 Post subject: table-per-subclass strategy, Renaming the Key in subtable?
PostPosted: Wed Feb 25, 2004 2:20 pm 
Regular
Regular

Joined: Fri Nov 07, 2003 6:31 am
Posts: 104
Location: Beijing, China
Hi,

i've got the following mapping (sorry for the fake lame names...)

Code:
<hibernate-mapping>
    <class name="org.xx.dossierformation.model.DF" table="DF">
        <id name="id" column="DF_ID" type="java.lang.Long">
            <generator class="identity"/>
        </id>

        <property name="dfF1" column="DF_F1" type="java.lang.String" not-null="true"/>

        <joined-subclass name="org.xx.dossierformation.model.DFStd" table="DFS">
            <key column="DF_ID"/>
            <property name="dfsInfo" column="DFS_INFO" type="java.lang.String" not-null="true"/>
        </joined-subclass>

        <joined-subclass name="org.xx.dossierformation.model.DFMasse" table="DFM">
            <key column="DF_ID"/>
            <property name="dfmInfo" column="DFM_INFO" type="java.lang.String" not-null="true"/>
        </joined-subclass>

    </class>
</hibernate-mapping>


tables look likes:
DF
-------------
DF_ID
DF_F1

DFS
-------------
DF_ID
DFS_INFO

DFM
-------------
DF_ID
DFM_INFO

I just would like to be able to rename the DF_ID column in the tables DFM & DFS following my conventions... (i.e. DFS_ID_FK, DFM_ID_FK)

Is there any way to do that???


Last edited by nodje on Tue Jun 03, 2008 5:19 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: BTW
PostPosted: Wed Feb 25, 2004 2:25 pm 
Regular
Regular

Joined: Fri Nov 07, 2003 6:31 am
Posts: 104
Location: Beijing, China
BTW, is there any way to prevent the creation of the superclass object itself from the mapping?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2004 2:32 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Why don't you just change the <key column="DF_ID"/> mappings?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 26, 2004 4:15 am 
Regular
Regular

Joined: Fri Nov 07, 2003 6:31 am
Posts: 104
Location: Beijing, China
You mean something like this:

Code:
<hibernate-mapping>
    <class name="org.xx.dossierformation.model.DF" table="DF">
        <id name="id" column="DF_ID" type="java.lang.Long">
            <generator class="identity"/>
        </id>

        <property name="dfF1" column="DF_F1" type="java.lang.String" not-null="true"/>

        <joined-subclass name="org.xx.dossierformation.model.DFStd" table="DFS">
            <key column="DFS_ID_PK"/>
            <property name="dfsInfo" column="DFS_INFO" type="java.lang.String" not-null="true"/>
        </joined-subclass>

        <joined-subclass name="org.xx.dossierformation.model.DFMasse" table="DFM">
            <key column="DFM_ID_PK"/>
            <property name="dfmInfo" column="DFM_INFO" type="java.lang.String" not-null="true"/>
        </joined-subclass>

    </class>
</hibernate-mapping>


?

It doesn't work, it seems to me that the key column needs to reference a unique identifier in the parent class.


Last edited by nodje on Tue Jun 03, 2008 5:19 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 26, 2004 4:26 am 
Regular
Regular

Joined: Fri Nov 07, 2003 6:31 am
Posts: 104
Location: Beijing, China
Ok sorry, wrong test, it works perfectly!!

But is there any way to prevent creation a single parent class from the maping?


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

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.