Return-Path: X-Original-To: apmail-openjpa-users-archive@minotaur.apache.org Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8825F97C1 for ; Thu, 21 Jun 2012 13:23:51 +0000 (UTC) Received: (qmail 36800 invoked by uid 500); 21 Jun 2012 13:23:51 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 36738 invoked by uid 500); 21 Jun 2012 13:23:51 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 36727 invoked by uid 99); 21 Jun 2012 13:23:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Jun 2012 13:23:51 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of kwsutter@gmail.com designates 209.85.217.174 as permitted sender) Received: from [209.85.217.174] (HELO mail-lb0-f174.google.com) (209.85.217.174) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Jun 2012 13:23:43 +0000 Received: by lbbgm6 with SMTP id gm6so2489375lbb.33 for ; Thu, 21 Jun 2012 06:23:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=s9pj4UHRp/BayWvZezQek89EuVU0eRfajkUz553RggQ=; b=KSRaHvyUBWi3N67z+l/uVvySUvNb5DDSbPSd+pPAn73ZROIRZB9lnuKPAZmA5vrygN zkXsJ+VPkZQGNbLnC98In/oJCGsEE4D12OF3jmC/Yqf7TT9+snoxo4w+m2yxRLLDAJFx d/qyKprvV/TWhLwUWZ03Rdb+ujCItGnwv4njwiawZCXZL3BdR742BHyOvbZ9Jh0jc+9v tClo8VsnkLZs1j+FXWaFucDGAXoObLSd7ualxn3TUeNtmEGoRtyRIZCD8iBqapqpMvyz qdjbIIpTgWa0mCTpm45SpAkq0TigpfTsb+5iWhNaZSNgsexkHecIvSOtnIC+mpX+rCEE p9gg== Received: by 10.112.17.195 with SMTP id q3mr12065093lbd.34.1340285002395; Thu, 21 Jun 2012 06:23:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.86.133 with HTTP; Thu, 21 Jun 2012 06:23:00 -0700 (PDT) In-Reply-To: References: From: Kevin Sutter Date: Thu, 21 Jun 2012 08:23:00 -0500 Message-ID: Subject: Re: Timestamp precision question. To: users@openjpa.apache.org Content-Type: multipart/alternative; boundary=bcaec55407c077300b04c2fb6b2c --bcaec55407c077300b04c2fb6b2c Content-Type: text/plain; charset=ISO-8859-1 Correct. On Wed, Jun 20, 2012 at 8:56 PM, yu wang wrote: > Kevin, > So if I need nanosecond, the Date precision should be 1,right? > > Regards, > Yu Wang > > On Wed, Jun 20, 2012 at 9:28 PM, Kevin Sutter wrote: > > Good to hear, Yu! > > > > It's kind of strange, but the base units used for timestamps are > > Nanoseconds. So, the DatePrecision specifies what multiplier to use to > get > > the desired precision. Multiply Nanos by 1000 and you get Micros. The > > default value for DatePrecision is 1000000, which then translates to > Millis. > > > > Kevin > > > > On Wed, Jun 20, 2012 at 4:54 AM, yu wang wrote: > > > >> Kevin, > >> It does work. Thanks! By the way, what does "DatePrecision=1000" mean? > Why > >> 1000? > >> > >> Regards, > >> Yu Wang > >> > >> > >> On Tue, Jun 19, 2012 at 10:04 PM, Kevin Sutter > wrote: > >> > Thanks, Yu, for the clarification. > >> > > >> > By default, OpenJPA uses Millisecond precision on the date fields > (least > >> > common denominator). Some of the data dictionaries have been updated > to > >> > Microsecond (DB2, Postgres, etc) or even Nanosecond (Ingres). It > looks > >> > like the Oracle dictionary is still using the default Millisecond > >> > precision. You can easily update this by modifying the Oracle > dictionary > >> > as follows: > >> > > >> > >> value="oracle(DatePrecision=1000)"/> > >> > > >> > If this does the trick for you and you feel that the default precision > >> for > >> > the Oracle dictionary should be Microseconds, please file a JIRA [1]. > >> > > >> > Thanks, Kevin > >> > > >> > [1] http://openjpa.apache.org/found-a-bug.html > >> > > >> > On Mon, Jun 18, 2012 at 11:24 PM, yu wang wrote: > >> > > >> >> Kevin > >> >> Before the field is persisted, I use toString() method of Timestamp > >> >> object to print the value of the field, its precision is microsecond. > >> >> But when I read the Timestamp field from DB, its precision is > >> millisecond. > >> >> > >> >> I need the precision of this Timestamp filed is microsecond. I am > >> >> using ORacle DB and I can insert microsecond Timestamp filed into DB > >> >> by SQL directly. > >> >> > >> >> Thanks, > >> >> Yu Wang > >> >> > >> >> On Mon, Jun 18, 2012 at 9:43 PM, Kevin Sutter > >> wrote: > >> >> > Hi Yu, > >> >> > Can you clarify your request? You said that your Timestamp > fields > >> are > >> >> > persisted to the DB at a millisecond level. But, I'm not following > >> your > >> >> > "print" comments and microsecond precision level. After retrieved > >> from > >> >> the > >> >> > DB, are the Timestamps still at a millisecond precision? Or, are > you > >> >> > looking to store the Timestamp to the DB at a microsecond > precision? > >> >> > Various databases have different practices as it comes to Timestamp > >> >> > precision. If you could clarify what your expectations are, maybe > >> >> > something can be figured out. Thanks. > >> >> > > >> >> > Kevin > >> >> > > >> >> > On Mon, Jun 18, 2012 at 4:31 AM, yu wang > wrote: > >> >> > > >> >> >> Hello, > >> >> >> I am using OpenJPA 1.2.2 connecting oracle DB. > >> >> >> For Timestamp field, the precision is always millisecond level > after > >> >> >> the filed is persisted into DB, regardless of I print the > timestampe > >> >> >> filed in java, its precision is microsecond level. > >> >> >> Any specific configuration I am not aware of? > >> >> >> > >> >> >> Below is a sample: > >> >> >> @Basic() > >> >> >> @Column(name="LOGTIME") > >> >> >> public java.sql.Timestamp getLogtime() { > >> >> >> return this.logtime; > >> >> >> } > >> >> >> @Override > >> >> >> public void setLogtime(java.sql.Timestamp logtime) { > >> >> >> this.logtime = logtime; > >> >> >> } > >> >> >> > >> >> >> Regards, > >> >> >> Yu Wang > >> >> >> > >> >> > >> > --bcaec55407c077300b04c2fb6b2c--