-->
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: Table Per Subclass w/ no columns on base class
PostPosted: Thu Dec 13, 2007 4:54 pm 
Newbie

Joined: Tue May 01, 2007 10:20 am
Posts: 9
Hi all. I'm starting a new project, and I'm running off the trunk.

I'm trying to use a mapping like the following...

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
   namespace="NHibernateFun.Domain" assembly="NHibernateFun">

   <class name="Entry" table="Entry">
      <id name="Id" unsaved-value="0" column="EntryId">
         <generator class="identity"/>
      </id>

      <joined-subclass name="FilledEntry" table="FilledEntry">
         <key column="FilledEntryId"/>
         <property name="Title" column="Title" not-null="true" />
         <property name="Text" column="Text" not-null="true" />
      </joined-subclass>

      <joined-subclass name="EmptyEntry" table="EmptyEntry">
         <key column="EmptyEntryId" />
      </joined-subclass>
   </class>

</hibernate-mapping>


As you can see, I have an abstract class Entry (which has no properties of its own to persist) that has two subclasses, FilledEntry and EmptyEntry. When trying to save either type of entry, I get the following error message..


Code:
could not insert: [NHibernateFun.Domain.FilledEntry][SQL: INSERT INTO Entry values ( )]


Can someone please explain to me if it's possible to alleviate this without switching to another inheritance method?

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.