-->
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: DiscriminatorColumn exported in DDL but not HBM.XML
PostPosted: Thu Nov 09, 2006 2:49 pm 
Newbie

Joined: Thu Nov 09, 2006 2:38 pm
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.20

Mapping documents: using JPA annotation

Hi guys, I hope I'm not doing something wrong here. There are two problems here actually, but I'm primarily concerned about the first one.

First problem:

I have one base class and two subclasses. Base class has the annotation:

Code:
@DiscriminatorColumn(name="DTYPE", discriminatorType=DiscriminatorType.INTEGER)
@DiscriminatorValue(value="0")


subclass has the

Code:
@DiscriminatorValue(value="0")


Hibernate schema export correctly creates DTYPE column with INTEGER type.

Unfortunately, the hbm.xml files are incorrect. The subclasses hbm.xml file has the "discriminator-value" attribute correct, but the base class hbm.xml is missing the "discriminator" element. At startup, I correctly get the discriminator column not specified error. Manually adding the following to the hbm.xml file causes that to go away.

Code:
<discriminator column="DTYPE" type="java.lang.Integer"/>


Second problem:

"Integer" discriminator type doesn't work. Causes NumberFormatException as the underlying code insists on using value of String. Replacing the above Integer with String causes this problem to go away.

Is there something more I need to do in order to use Integer discriminator values?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 10, 2006 2:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
why are you talking about hbm.xml files if you are using jpa annotations ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 10, 2006 3:36 pm 
Newbie

Joined: Thu Nov 09, 2006 2:38 pm
Posts: 2
Thanks a bundle. I've been previously using the hbm.xml and tried switching to JPA but didn't read the docs. Guess it doesn't make sense since the annotation in the runtime already contains sufficient information.


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.