-->
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: Abstract composite-element with subclasses
PostPosted: Mon Feb 06, 2006 11:31 am 
Newbie

Joined: Wed Apr 14, 2004 4:58 am
Posts: 6
Hi,

i try to map a list of dependent objects which can be different classes. The mapped dependent object is abstract.

Example:
<class name="container">
[...]
<list name="content" table="container_content">
<key column="container_id"/>
<composite-element class="AbstractContent" abstract="true">
<discriminator column="type" type="char"/>
<property name="name"/>
<subclass name="ContentA">
</subclass>
<subclass name="ContentB">
<property name="test"/>
</subclass>
</composite-element>
</list>
</class>

I think this should create a table:
container_content (container_id,type,name,test)

Instead i get a table:
container_content (container_id,type)


When i try to save such a "container" with some content, a get an InstantiationException because hibernate tries to insantiate the AbstractContent class.

I played around with many parameters (e.g. lazy="false") with no success.

Anyone who can help me?

Edit: I use hibernate 3.0.2.


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.