-->
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: BigDecimal Oracle mapping
PostPosted: Tue Jan 10, 2012 3:57 am 
Newbie

Joined: Tue Jan 10, 2012 3:49 am
Posts: 7
Hi,

We are using Hibernate 3.6 and Oracle 11g. We generate db schema with hibernate tools. If we don't specify precision and scale on bigdecimal properties, they are created with number(19, 2). Can we change this setting to number(19,6) globally without giving scale and precision on every bigdecimal property.


Top
 Profile  
 
 Post subject: Re: BigDecimal Oracle mapping
PostPosted: Tue Jan 10, 2012 5:15 am 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
One solution could be to subclass your dialect and override registerNumericTypeMappings. In this method you should just call the super-method and add
Code:
registerColumnType( Types.NUMERIC, "number(19,6)" );
registerColumnType( Types.DECIMAL, "number(19,6)" );

Then use this dialect in your config (e.g. persistence.xml).

Also see the src of Oracle8iDialect, if that helps.

_________________
-----------------
Need advanced help? http://www.viada.eu


Top
 Profile  
 
 Post subject: Re: BigDecimal Oracle mapping
PostPosted: Tue Jan 10, 2012 6:32 pm 
Newbie

Joined: Tue Jan 10, 2012 3:49 am
Posts: 7
Thanks for reply.
But if we register types like you suggest, we can not override precision and scale with column annotation.
We have lots of big decimal properties but only small of amount of them have different precision and scale.


Top
 Profile  
 
 Post subject: Re: BigDecimal Oracle mapping
PostPosted: Fri Jan 13, 2012 5:12 am 
Newbie

Joined: Tue Jan 10, 2012 3:49 am
Posts: 7
Any help really appreciated.


Top
 Profile  
 
 Post subject: Re: BigDecimal Oracle mapping
PostPosted: Mon Jan 16, 2012 11:23 am 
Newbie

Joined: Mon Jan 16, 2012 10:52 am
Posts: 2
Hi,

We are facing a similar problem in our project. We are subclassing our dialect and overriding registerNumericTypeMappings as mmerder suggested.
However we would like to override it for some of them.

Is there a possible way to do this ?

Need help also.

Thank you.


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.