-->
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.  [ 6 posts ] 
Author Message
 Post subject: why does SchemaExport turn BigInteger into numeric(19,2)?
PostPosted: Wed Nov 30, 2005 4:59 pm 
Beginner
Beginner

Joined: Wed Nov 30, 2005 2:41 pm
Posts: 29
Hibernate version: 3.1rc3; jdk 1.4.2_06
SchemaExport (hbm2ddl) takes a BigIntegerType and makes it numeric(19,2) for the DB2 (and DB2400) dialects. Should be (n,0) I would think. For HSQL it's just "numeric".
Mapping documents:
Code:
<property name="TestNonNegInteger">
<column name="TestNonNegInteger"/>
<type name="org.hibernate.type.BigIntegerType"/>
</property>

SQL:
Code:
create table Test1 (..., TestNonNegInteger numeric(19,2), ...);

I'm actually using a hyperJaxb2 ant script to run this, but for this particular step, I believe only hibernate (SchemaExportTask) is involved.
I looked at the hbm2ddl code briefly, but couldn't figure out where the default scale of 2 was coming from.

any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 5:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
2 is the default scale used in hibernate when you don't specify anything - the same is 19 the default for length and precision.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 6:21 pm 
Beginner
Beginner

Joined: Wed Nov 30, 2005 2:41 pm
Posts: 29
But shouldn't any Integer type have a scale of zero? Actually, since DB2 supports BIGINT, that would seem the most natural conversion for BigIntegerType. In fact, DB2Dialect.java includes this:

registerColumnType( Types.BIGINT, "bigint" );

but that's apparently not used in this situation.

My other option is to look at the hyperjaxb side to see how to generate an explicit scale for that case.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 6:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
did you try with big_integer?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 6:42 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
in any case scale="0" would do what you want.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 7:04 pm 
Beginner
Beginner

Joined: Wed Nov 30, 2005 2:41 pm
Posts: 29
did i try big_integer where? I haven't tried modifying any of the hibernate code yet.

I tried scale="0" in hbm & that worked -- got 'numeric(19,0)' -- Thanks! I just have to get hyperjaxb to do that automatically.

But it still seems odd to have to specify scale for an integer type.

I think it'd be better/simpler if SchemaExport generated a DB2 type of BIGINT for BigIntegerType.


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