I found that care needs to be taken when using Floats, Doubles, BigDecimal,
etc... OpenJPA seemed to work in most cases when I was using existing table
definitions but I can't say that OpenJPA always generated the proper tables
when using synchronize mappings. One oddity/problem I came across had to do
with performing arithmetic inside a select on DB2 (and maybe derby). I don't
have my notes infront of me right now, but I will open a JIRA for the
problems I found sometime here.


On Thu, Jan 7, 2010 at 11:37 AM, C N Davies <c...@cndavies.com> wrote:

> Well I haven't fully tested all possible cases, but my app works to 4
> decimal places so I use the column definition shown below (6 places) and I
> do not get rounding issues any more. It was a big problem for me when I
> first started using OpenJPA a year or so ago because I am back calculating
> tax on low value high qty items.
>
> Chris
>
>
> -----Original Message-----
> From: Daryl Stultz [mailto:da...@6degrees.com]
> Sent: Friday, 8 January 2010 12:30 AM
> To: users@openjpa.apache.org
> Subject: Re: Known issues - Floats and doubles may lose precision when
> stored.
>
> On Thu, Jan 7, 2010 at 6:24 AM, C N Davies <c...@cndavies.com> wrote:
>
> > I'm no expert on this but I find OpenJPA 1.2.1 works just fine on
> > ProgresSQL
> > when I use specific notation
> >
> >        @Column(columnDefinition="DOUBLE UNSIGNED",precision=10,scale=6,
> > nullable=false)
> >        private double rate = 0.00;
> >
> > If I don't use the column definition it's a mess
>
>
> The manual [1] states that columnDefinition, precision, and scale are used
> for database creation (DDL generation). I'm wondering if you have the
> database column correctly does that prevent precision loss or is there
> value
> truncation of some kind before going to the database.
>
> [1]
>
> http://openjpa.apache.org/builds/1.2.1/apache-openjpa-1.2.1/docs/manual/jpa_
> overview_mapping_column.html<http://openjpa.apache.org/builds/1.2.1/apache-openjpa-1.2.1/docs/manual/jpa_%0Aoverview_mapping_column.html>
>
>
> --
> Daryl Stultz
> _____________________________________
> 6 Degrees Software and Consulting, Inc.
> http://www.6degrees.com
> mailto:da...@6degrees.com
>
>


-- 
Thanks,
Rick

Reply via email to