-->
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: what is hibernate mapping type for tinyint?
PostPosted: Thu Oct 09, 2003 5:15 am 
Newbie

Joined: Thu Oct 09, 2003 5:00 am
Posts: 4
Hi all,

What is hibernate mapping type for SQLServer's field type of tinyint?

Thanks,
/bernard


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 09, 2003 7:41 am 
Senior
Senior

Joined: Tue Sep 23, 2003 8:18 am
Posts: 137
Location: Johannesburg, South Africa
Quote:
tinyint

Integer data from 0 through 255. Storage size is 1 byte.

-From MS SQL documentation.

And the Java types that you can use (generally):

Byte: -128 to 127
Short: -32768 to 32767
Integer: -2147483648 to 2147483647

So, since SQLServer's tinyint is 0-255 (An unsigned byte), you'll have to use Short since it's the smallest Java number type that'll match.

You'll find the Hibernate type as: net.sf.hibernate.type.ShortType

Hope that helps. This isn't really a Hibernate issue, but rather a Java type vs SQL (MS) Type.

-G


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 09, 2003 8:20 am 
Newbie

Joined: Thu Oct 09, 2003 5:00 am
Posts: 4
Many thanks Brannor!

Brannor McThife wrote:
Quote:
tinyint

Integer data from 0 through 255. Storage size is 1 byte.

-From MS SQL documentation.

And the Java types that you can use (generally):

Byte: -128 to 127
Short: -32768 to 32767
Integer: -2147483648 to 2147483647

So, since SQLServer's tinyint is 0-255 (An unsigned byte), you'll have to use Short since it's the smallest Java number type that'll match.

You'll find the Hibernate type as: net.sf.hibernate.type.ShortType

Hope that helps. This isn't really a Hibernate issue, but rather a Java type vs SQL (MS) Type.

-G


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.