Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 82028 invoked from network); 10 Apr 2007 20:01:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Apr 2007 20:01:28 -0000 Received: (qmail 41984 invoked by uid 500); 10 Apr 2007 20:01:34 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 41957 invoked by uid 500); 10 Apr 2007 20:01:34 -0000 Mailing-List: contact open-jpa-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: open-jpa-dev@incubator.apache.org Delivered-To: mailing list open-jpa-dev@incubator.apache.org Received: (qmail 41948 invoked by uid 99); 10 Apr 2007 20:01:34 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Apr 2007 13:01:34 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of michael.d.dick@gmail.com designates 66.249.82.233 as permitted sender) Received: from [66.249.82.233] (HELO wx-out-0506.google.com) (66.249.82.233) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Apr 2007 13:01:27 -0700 Received: by wx-out-0506.google.com with SMTP id i26so2120883wxd for ; Tue, 10 Apr 2007 13:01:07 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=KEe8UDBCtWme60QBh29eQn7YwbhTOlqZ/fRSCbDmwzj2be2CpZU3kEKZV2D2oLGTIKFFbMqP6EKv+V2IWP3Tzl43leNKKpvOUS4LiFzszkbxb6jal+0jGnYDnWpzCcZlJ3iKft8IsIHT/DZg8vZcDO5cfRcWd8AEG1WDJ+vxVZg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=QfU5X2ltMTkIF6xETOafLf5EUXYr31WGwqMi1oPEt5/caOQZN7MP6q7Xv/V2mNWxUcd7ehcJ9GTBCzw6AdqWACLmiz/KqEmtydQMNanaKlTsQ4Uz53L7gc/UAAbfUs86pvaBilXLE3dBQ3q7zbVPt2QjV148sg4vE9+oOeh2lm0= Received: by 10.100.191.5 with SMTP id o5mr5235786anf.1176235267045; Tue, 10 Apr 2007 13:01:07 -0700 (PDT) Received: by 10.100.6.16 with HTTP; Tue, 10 Apr 2007 13:01:06 -0700 (PDT) Message-ID: <72c1350f0704101301m5a6cf635m9c4d4c57a2b34ecd@mail.gmail.com> Date: Tue, 10 Apr 2007 15:01:06 -0500 From: "Michael Dick" To: open-jpa-dev@incubator.apache.org, jacek@laskowski.net.pl Subject: Re: @Column with precision and scale - how does it work? In-Reply-To: <1b5bfeb50704101024v20824132mdf9fccbce8f6b395@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_35335_10843343.1176235266772" References: <1b5bfeb50704101024v20824132mdf9fccbce8f6b395@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_35335_10843343.1176235266772 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I don't think Derby supports specifying the precision on type DOUBLE (maybe other datbases do). You should be able to specify the precision through the @Column annotation. I believe @Column(columnDefinition="DECIMAL(5,2)") will work. I'm not sure whether precision=x, scale=y with a type that maps to DECIMAL instead of DOUBLE. On 4/10/07, Jacek Laskowski < jacek@laskowski.net.pl> wrote: > > Hi, > > I wonder how I could restrict what values are inserted into a table > using @Column(precision=5, scale=2). When does it matter? > > I'm using OpenJPA 0.9.7-SNAPSHOT with Derby and with the following: > > @Column(precision = 5, scale = 2) > public double getPensja() { > return pensja; > } > > OpenJPA executes the following CREATE > > 2969 derbyPU TRACE [main] openjpa.jdbc.SQL - 18662247> executing stmnt 23119024 CREATE TABLE Osoba (numer BIGINT > NOT NULL, dzienImienin TIMESTAMP, dzienUrodzin > TIMESTAMP, imie VARCHAR(255), kraj VARCHAR(255), nazwisko > VARCHAR(255), wersja INTEGER, pensja DOUBLE, tytul VARCHAR(255), > PRIMARY KEY (numer)) > > How could I restrict the precision and scale of the pensja field? Is > the columnDefinition attribute of @Column the last resort? When is the > others used? What databases are supported? > > Jacek > > -- > Jacek Laskowski > http://www.JacekLaskowski.pl > -- -Michael Dick ------=_Part_35335_10843343.1176235266772--