-->
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: discriminator with type"int"
PostPosted: Mon Aug 27, 2007 3:29 pm 
Newbie

Joined: Thu Jan 18, 2007 4:45 pm
Posts: 10
Does Hibernate Support it correctly ? Because i've been searching the web for examples and even in the hibernate's site I haven't found nothing with the int type, all example uses string type...

I tried this in my table per class mapping XML file....


Code:

<discriminator   column="code" type="int" />

...

<subclass     name="MySubClass" extends="MyParentClass"   discriminator-value="1" >
                    <property name="..."    column="..." />
                    <property name="..."     column="..."/>
</subclass>



for no success, the stack trace shows this error:

org.hibernate.MappingException: Could not format discriminator value to SQL string

i've changed the database to varchar and the <discriminator-value> to a string value (like CARD,CHECK).... and used type="string" and everything was fine.....but when i try to use int (making the necessary changes of course) this error occurs....

can somebody give me tip or clue???
Thanks in advance!!

[/code]

_________________
Dan Mopont


Top
 Profile  
 
 Post subject: Re: discriminator with type"int"
PostPosted: Mon Aug 27, 2007 3:42 pm 
Beginner
Beginner

Joined: Mon Aug 27, 2007 8:10 am
Posts: 37
mopont wrote:
Does Hibernate Support it correctly ?


It works for us, altough we use Integer, not int.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 28, 2007 1:07 am 
Regular
Regular

Joined: Wed Jun 20, 2007 1:53 am
Posts: 75
Does Hibernate Support it correctly ?

Yes. Hibernate supports for int. Use Integer inside the POJO as hutorny suggested.

It is best practice to use object rather than primitive inside the POJO for property types.


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.