-->
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.  [ 2 posts ] 
Author Message
 Post subject: Was: HHH-1711 BigDecimalType vs. IdentifierGeneratorFactory
PostPosted: Wed May 03, 2006 4:15 pm 
Newbie

Joined: Wed May 03, 2006 4:08 pm
Posts: 1
Location: Palo Alto, CA
Why doesn't hibernate tools generate longs instead of BigDecimals? Or why aren't BigDecimals supported by the IdentifierGeneratorFactory? Either would make it a much more user friendly setup. I have 1000+ tables,
would be great if I didn't have to visit every single one of them manually, every time I reveng the schema. (Which is really no big deal with a few sed scripts/vim macros, etc., I just tend to be forgetful.)

Lastly, using long instead of BigDecimal should really be innocuous, right? (I'm not in the position to make schema changes.)

Any help is appreciated,
Gabor


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 04, 2006 1:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
1) BigDecimals is not supported by the id strategy because it is inefficient. If you want it to be inefficient then you just need to implement it in your own subclass.

2) Hibernate does generate long's by default if the underlying field is "small" enough to contain it. What is the generated mappings for you ?


So, either use a different id strategy or change the type. You can do that generally by specifying something like the following in your reveng.xml:

Code:
         <type-mapping>
      <sql-type jdbc-type="NUMERIC" precision='22' hibernate-type="long" />
   </type-mapping>


which tells the reverse engineering to use long for columns that are java.sql.Types.NUMERIC and has a a precision of 22.

_________________
Max
Don't 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.  [ 2 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.