-->
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: Inheritence with component mapping
PostPosted: Tue Mar 21, 2006 7:50 pm 
Newbie

Joined: Tue Mar 21, 2006 7:18 pm
Posts: 13
Hi,

I am usind Hibernate 3.1.

I have one superclass. It has two subclasses and a component mapping. This should be mapped to one table.

It seems that this two mappings don't work together. Is there a reason for it? Is it not allowed to put them together.


The error lookes like this:

Error parsing XML: XML InputStream(196) The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,
(id|composite-id),discriminator?,natural-id?,
(version|timestamp)?,
(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,
((join*,subclass*)|joined-subclass*|union-subclass*),
loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,
(query|sql-query)*)"

As far as I understand this expression it isn't forbidden to use <subclass> and <component> in the same <class>

Both mappings <subclass> and <component> work without another, but they do not work together.

I hope somebody can help.

Greetings,

Jakob




Here is the Mapping:

<class name="Superclass"
discriminator-value="AA">

<id name="id" column="ID" type="integer">
<generator class="sequence" />
</id>

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

<subclass
name="Subclass1"
discriminator-value="GA">


<property name="attribute1" type="integer">
<column name="ATTRIBUTE1" not-null="true" />
</property>

<property name="a2" type="integer">
<column name="A2" not-null="true" />
</property>

<property name="a3" type="string">
<column name="A3" not-null="true" length="255" />
</property>

</subclass>

<subclass
name="Subclass2"
discriminator-value="TA">

<property name="a5" type="string">
<column name="a5" not-null="true" length="5000" />
</property>

</subclass>

<component
name="comp"
class="Comp">

<property name="x" type="integer">
<column name="X" not-null="true" />
</property>

<property name="y" type="integer">
<column name="Y" not-null="true" />
</property>

</component>

</class>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 21, 2006 9:57 pm 
Newbie

Joined: Tue Mar 21, 2006 1:42 pm
Posts: 14
Component elements should come before subclass elements.

_________________
Mike Ringrose


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 22, 2006 7:27 am 
Newbie

Joined: Tue Mar 21, 2006 7:18 pm
Posts: 13
Thank you,

this worked out.

I didn't know the sequencing is important.

Jakob


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.