-->
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.  [ 5 posts ] 
Author Message
 Post subject: Schema Generation and Length,Precision,Scale... so confused!
PostPosted: Wed Aug 10, 2005 3:07 pm 
Beginner
Beginner

Joined: Mon Nov 29, 2004 11:51 am
Posts: 31
Hibernate version: 3.1

Hibernate tools version: 3.0 alpha 4.a

I'm trying to generate schema DDL from my hibernate mapping. The documentation at http://www.hibernate.org/hib_docs/refer ... guide.html says to specificy the 'length' attribute in the 'column' element for "column length/decimal precision". But then I see examples, etc in the forums that use 'length' for text columns and 'precision' & 'scale' for numeric columns. This makes sense, but I dont' see it documented anywhere... In fact the documetation that I see, does not even mention a way to specify the decimal precision (the 'scale' attribute).

So first question is, why do I see no 'precision' and 'scale' attribute in hibernate tools documentation (is just undocumented at this time, or is it for something else)?

Either way, no matter what I use... length, precision, scale or any combination of those, they never get used in my schema generation. I get DDL without column lengths.
According to this thread, it looks like I can specify these things in the 'sql-type' attribute.
http://forum.hibernate.org/viewtopic.ph ... ema+length
So then what are all these length,precision and scale attributes for? Or is just a bug that's still there?

Could somebody please enlightmen me.... sooooo confused.

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 2:07 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the last thread is about reverse engineering and how to specifcy which hibernate type should be used for a certain sql-type..

The other part of your thread is about schemaexport/hbm2ddl which should just work with precision, length and scale.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 3:11 am 
Beginner
Beginner

Joined: Mon Nov 29, 2004 11:51 am
Posts: 31
Quote:
The other part of your thread is about schemaexport/hbm2ddl which should just work with precision, length and scale.


What exactly do you mean by "should work with"? Are you saying that, had I done things correctly, it should utilize my length,precision and scale attributes for the output?

The main issue I have (aside from my documenation confusion) is that I do define length, precision and scale in my hibernate mapping, but hbm2ddl just ignores it. It outputs ddl without any column width definition.

If you're telling me that it should work, then I'll spend more time trying to debug my stuff. What drove me to post this, is that I couldn't find any specific documenation on precision/scale, so I wasn't sure if I was just wasting my time trying to use a non-existent feature (although it wouldn't explain why 'length' isn't working for me either).

BTW.. in case it makes a difference, I'm using the ant task.
org.hibernate.tool.hbm2ddl.SchemaExportTask

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 5:19 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if your dialect has the right types defined with $s,$l and $p in the type definitions then it should just work.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 25, 2006 4:07 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
Yep,

for DB2 changing the line

Code:
registerColumnType( Types.DOUBLE, "double" );


to

Code:
registerColumnType( Types.DOUBLE, "numeric($p,$s)" );


in the constructor of DB2Dialect works.
So far this modification does not seem to have any side effect.

_________________
dont forget to rate !


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