-->
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.  [ 4 posts ] 
Author Message
 Post subject: <subclass> problem with 3.1.{2,3}
PostPosted: Thu Mar 23, 2006 11:55 am 
Newbie

Joined: Fri Feb 20, 2004 6:26 am
Posts: 12
Hi,

I have the following mappings for a 'public abstract class Mob' and its subclass 'Sequence'. Somehow I can't seem to get this to fly with 3.1.{2,3}. Can somebody please comment?

Thanks.


<hibernate-mapping default-access="field">
<class name="Mob"
table="mobs"
discriminator-value="untyped">

<cache usage="nonstrict-read-write"/>

<id name="id" type="long">
<generator class="native"/>
</id>

<version name="version"/>

<property name="mobId" not-null="true" index="mob_mobid_index"/>

</class>

<subclass name="Sequence"
extends="Mob"
discriminator-value="sequence"/>

<query name="findSequencesByMobIds">
from Sequence seq
where seq.mobId in (:mobids)
</query>
</hibernate-mapping>


org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [/home/tom/projects/nxn-software.com/wog/sandbox/build/wog-exp/WEB-INF/classes/com/avid/wog/spring-hibernate.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: No discriminator found for Sequence. Discriminator is needed when 'single-table-per-hierarchy' is used and a class has subclasses
org.hibernate.MappingException: No discriminator found for Sequence. Discriminator is needed when 'single-table-per-hierarchy' is used and a class has subclasses
at org.hibernate.mapping.SingleTableSubclass.validate(SingleTableSubclass.java:41)
at org.hibernate.cfg.Configuration.validate(Configuration.java:984)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1169)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:871)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 23, 2006 12:20 pm 
Regular
Regular

Joined: Tue Nov 16, 2004 6:36 pm
Posts: 62
Location: Zürich
You have not declared your discriminator column.

Add something like

<discriminator column="mob_type"/>

after your <id/>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 24, 2006 5:43 am 
Newbie

Joined: Fri Feb 20, 2004 6:26 am
Posts: 12
Thanks. That worked.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 24, 2006 8:57 am 
Regular
Regular

Joined: Tue Nov 16, 2004 6:36 pm
Posts: 62
Location: Zürich
tquas wrote:
Thanks. That worked.

Good, I would be grateful if you could rate my post :). Otherwise I'm soon out of questions here.


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