-->
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.  [ 2 posts ] 
Author Message
 Post subject: Error when fetching collection of subclass
PostPosted: Fri May 19, 2006 5:44 pm 
Newbie

Joined: Fri May 19, 2006 4:44 pm
Posts: 1
Location: Belgium
Hi,

I am combining table-per-class inheritance and table-per-class-hierarchy inheritance as follows:

<class name="Universe" table="universe">
<id name="id" column="universe_id" type="java.lang.Integer">
<generator class="increment"/>
</id>

<set name="dimensions" inverse="true" cascade="all-delete-orphan" lazy="false" >
<key column="universe_id" />
<one-to-many class="Dimension"/>
</set>

</class>

<class name="Region" table="region">
<id name="id" column="region_id" type="java.lang.Integer">
<generator class="increment"/>
</id>

<discriminator column="discriminator" type="string"/>

<subclass name="Dimension" discriminator-value="D">
<join table="dimension">
<key column="region_id"/>
<many-to-one name="universe" column="universe_id" class="Universe" not-null="true" />
<property name="name" column="name" type="java.lang.String"/>
</join>
</subclass>

<subclass name="AsteroidBelt" ..>
</class>

The first class has a collection of Dimensions. The foreign key to a Universe of a Dimension is within the subclass table "dimension". Now, persisting a universe with dimensions goes fine, but when I try to load it,
I get the error "Unknown column 'dimensies0.universe_id' in 'field list'", although the column 'universe_id' is in the joined subclass table.

It seems when trying to fetch the dimensions collection, Hibernate ignores the properties defined in the joined table and so does not find the universe_id column.

Is this expected behaviour or a bug? And is there an elegant workaround for this? Right now, I moved the universe_id column to the region table and made it nullable. It works, but it doesn't really feel satisfying.

I am using MySql Server 5.0 and Hibernate 3.0.5.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 12, 2008 2:47 pm 
Newbie

Joined: Wed Mar 12, 2008 1:09 pm
Posts: 1
Hi SteffenL,

i'm having the same problem as you, have you found a solution since?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.