[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2799) Default Scale value doesn't right

Henri Tremblay (JIRA) noreply at atlassian.com
Mon Nov 12 17:44:29 EST 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_28805 ] 

Henri Tremblay commented on HHH-2799:
-------------------------------------

Hum... I'll comment my comment.

I just learned that typing Number create a floating point. That will bring me to think that a it would be a bad thing to have a BigDecimal mapping to a floating point in the database. 

Putting 19 by default is a little surprising since the maximum for Oracle is 38 so one can wonder where this value is coming from. 

The 2 is also surprising since working in finance, for me 5 is the minimum default I would use.

I fixed my issue typing everything with precision=38, scale=10 (19 with a scale of 10 is too short).

So, I now one thing that disturbed me and one wish.

The 2 is still a bug from my point of view since the default in @Column is 0 according to JPA. So I think the default should be respected or at least the 2 documented in hibernate annotations' doc.

Then, what would be nice is to be able to set our own defaults for a given type.Right now, that doesn't seem possible without overloading the dialect (and that might not be true since I don't know if the scale and precision are used for something else than database generation).

> Default Scale value doesn't right
> ---------------------------------
>
>                 Key: HHH-2799
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2799
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: metamodel
>    Affects Versions: 3.2.0.ga
>         Environment: Name and version of the database you are using:MySQL 5.0.37
>            Reporter: Bliznets Roman
>   Original Estimate: 2 hours
>  Remaining Estimate: 2 hours
>
> In my Mapping documents:
> ...
> <property name="goodsNumeric" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.math.BigInteger">
> <column not-null="false" unique="false" name="`goodsnumeric`" precision="5"/>
> </property>
> ...
> From MySQL documentation
> In standard SQL, the syntax DECIMAL(M) is equivalent to DECIMAL(M,0).
> But In log and in database scale=2, it's have to be exactly 0.
> Debug level Hibernate log excerpt:
> 12484 [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaUpdate - create table `goodsitembasetype` (e_id bigint not null auto_increment, e_version integer not null, `goodsnumeric` numeric(5,2), `grossweightquantity` numeric(19,6), `netweightquantity` numeric(19,6), `invoicedcost` numeric(16,2), `customscost` numeric(16,2), `statisticalcost` numeric(16,2), primary key (e_id)) 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list