openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Dick (JIRA)" <>
Subject [jira] Commented: (OPENJPA-213) @Column with precision and scale should result in NUMERIC(precision, scale)
Date Tue, 08 May 2007 13:44:15 GMT


Michael Dick commented on OPENJPA-213:

I'm not sure I agree with the description of the problem. 

I've been basing my assumptions on the conversions tables found at

The tables there indicate that a java.lang.Double should be mapped to DOUBLE, not NUMERIC
or DECIMAL. If NUMERIC or DECIMAL is desired then the entity should use a variable of type

The way the problem description is worded we'd be changing the rules if precision and scale
were specified in an annotation.  It becomes a question of which is more important, the type
of the variable or the annotations around it. An argument can be made for either side, but
I'm inclined to side with the type of the variable trumping the annotations. I believe the
language in the spec supports this interpretation too : 

>From section 9.1.5 
int precision (Optional) The precision for a decimal (exact    0 (Value must be set by
              numeric) column. (Applies only if a decimal col- developer.)
              umn is used.)
int scale     (Optional) The scale for a decimal (exact        0
              numeric) column. (Applies only if a decimal col-
              umn is used.)

Assuming that is the correct approach, there is still a problem with DB2 and Derby where the
mapping tool creates a DOUBLE column for BigDecimals instead of a NUMERIC column. I'll use
this JIRA to fix the problem with DB2 and Derby.

> @Column with precision and scale should result in NUMERIC(precision, scale)
> ---------------------------------------------------------------------------
>                 Key: OPENJPA-213
>                 URL:
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: jpa
>    Affects Versions: 0.9.7
>            Reporter: Jacek Laskowski
>         Assigned To: Michael Dick
> @Column provides the precision and scale attributes, but there's no (easy) way to figure
out how it affects the way OpenJPA works if any. It looks like OpenJPA reads the type of a
persistent field and when it's double it maps it to DOUBLE in Derby regardless of the other
attributes. When precision and scale are specified, a DDL should use NUMERIC(precision, scale)
or its synonim - DECIMAL(precision, scale).

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message