-->
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: Creating a child entry only when using joined-subclass
PostPosted: Thu Sep 17, 2009 6:36 pm 
Newbie

Joined: Thu Sep 17, 2009 6:20 pm
Posts: 2
I need to create a row in my child table without creating a row in my parent table (since it already exists). Is there any way to do this? Here's a sample hbm file:

Code:
<hibernate-mapping default-lazy="false">
   <class name="Person"
      table="person">

      <id name="personId" type="java.lang.Integer"
         column="person_id">
         <generator class="native" />
      </id>

      // Some properties here

      <joined-subclass
         name="Author"
         table="author">
         <key column="person_id" />

         // Some properties here

      </joined-subclass>
   </class>
</hibernate-mapping>


Is there any way to add a row to the author table without adding a row to a person table? Every row in the person table could have 0 or 1 corresponding row in the author table since not every person has to be an author =)

Thanks in advance!


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.