-->
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.  [ 3 posts ] 
Author Message
 Post subject: joined-subclass and composite-id??
PostPosted: Fri Feb 13, 2004 8:23 am 
Newbie

Joined: Fri Feb 13, 2004 7:59 am
Posts: 8
Location: Gavle, Sweden
Hi there,
I have a problem with inheritance mapping.
It seems that its not possible to use the table-per-subclass
mapping when the super class has a composite id.

This is my mapping file:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping package="test1">
<class name="Ingivning" table="INGIVNING" >
<composite-id name="ingivningid" class="test1.IngivningId">
<key-property name="arendeid"/>
<key-property name="ingivningindex"/>
</composite-id>
<version name="version" unsaved-value="undefined" />

<property name="organisation" />
<component name="namn">
<property name="fornamn" />
<property name="efternamn" />
<property name="adress" />
<property name="postnummer" />
<property name ="postort" />
</component>
<property name="ingivartyp" />
<property name="anmarkning" />
<property name="sekretess" />

<many-to-one name="arende" class="Arende" >
<column name="arende_arendeid" not-null="true"/>
</many-to-one>

<joined-subclass name="IngMedIngNr" table="IngMedIngNr">
<key column="arendeid"/>
<key column="ingivningindex"/>

<many-to-one name="ingivare" column="id" not-null="true" />
</joined-subclass>

<joined-subclass name="IngMedPerNr" table="IngMedPerNr">
<key column="arendeid"/>
<key column="ingivningindex"/>
<many-to-one name="person" column="personid" not-null="true" />
</joined-subclass>
</class>
</hibernate-mapping>

When I run SchemaExport I get an Exception saying that the content of the joined-subclass element must match(meta*,key,(property....blablabla)
And if I change the joined-subclass element so it contains:
<key>
<column="arendeid"/>
<column="ingivningindex"/>
</key>
it complains that element type "null" (i.e. key) must contain either attribute specifications,">" or "/>"

I would really appreciate if someone has the answer to my problem.
Regards,
Henrik


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 13, 2004 8:30 am 
Newbie

Joined: Thu Sep 04, 2003 3:36 am
Posts: 11
Location: Karlsruhe/Germany
Not sure if i'm right,
but shouldn't it be:

Code:
<key>
<column name="arendeid"/>
<column name="ingivningindex"/>
</key>

[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 13, 2004 8:40 am 
Newbie

Joined: Fri Feb 13, 2004 7:59 am
Posts: 8
Location: Gavle, Sweden
Thanks!
That solved the problem,
I think I got blind after a couple of hours experimenting!
Anyway, now it works!
Thanks again
/Henrik


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