-->
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: XML mapping and polymorphism
PostPosted: Fri Jul 29, 2005 9:36 am 
Newbie

Joined: Fri Jul 29, 2005 9:26 am
Posts: 2
I'm trying to map two concrete classes with an abstract base class, and be able to bulk load from XML.

The issue I'm hitting is that my XML has different attributes for the item id, and there appears to be no way to specify this in my mapping document using either union-subclass or joined-subclass

Hibernate version:
Hibernate 3 production version.

Mapping documents:
Here is approximately what I'm trying to do:

<pre>
<class name="com.ioko.iod.bean.item.AbstractItem">
<id name="id" column="id">
<generator class="assigned"/>
</id>
<property name="title" not-null="true" node="Title"/>
<property name="description" node="Synopsis"/>

<union-subclass name="com.ioko.iod.bean.item.ProgramItem" table="program_info" node="ProgramInformation">
<key column="program_id"/> <!-- key not allowed here -->
</union-subclass>
<union-subclass name="com.ioko.iod.bean.item.GroupItem" table="group_info" node="GroupInformation">
<key column="group_id"/>
<property name="type" node="@Type"/>
</joined-subclass>
</class>
</pre>

Name and version of the database you are using:
HSQLDB

Is this possible. I'm going to try it with an additional generated id and see if it works that way, but not ideal.

Alfie.


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.