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 E0BF2DFA5 for ; Tue, 19 Jun 2012 14:05:00 +0000 (UTC) Received: (qmail 54368 invoked by uid 500); 19 Jun 2012 14:05:00 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 54324 invoked by uid 500); 19 Jun 2012 14:05:00 -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 54313 invoked by uid 99); 19 Jun 2012 14:05:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Jun 2012 14:05:00 +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 (athena.apache.org: domain of kwsutter@gmail.com designates 209.85.215.174 as permitted sender) Received: from [209.85.215.174] (HELO mail-ey0-f174.google.com) (209.85.215.174) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Jun 2012 14:04:53 +0000 Received: by eaak11 with SMTP id k11so2137435eaa.33 for ; Tue, 19 Jun 2012 07:04:32 -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=1d11QNPnVdJ6z98BUKgsQ1ad4Aqz9YHtwxhBiirOrA8=; b=kRrYPmIjNMlZ03mL7fVvnyR1KX7YMzl6xNE1OlM+4YmJZ39Dr3NrPZuPaqLA+A4U5D qm828FQPQtA/KjU+m6sc9TMmcXMKHGwerF4zhsrfdzR2l9ZVYU1j2bcatm0WOBNBRJQe v1E82/zNwDtWbYNvMrHivujpF9xoNVA2o6GntaQ994FIehSwY22x/HoVz1p45KJSk7NM 41T+dhdSd5A7bckUihPJqq38h7Wl0FFn4uVpTVDwNs9Kb7ubc1BVR0JrkSE+uKru0kmj E0KIxZRyK2P159xRWtix2N8/Pe7U9Q86Ee6+Enkk+svEfzxPKAt/ZOZcOoObeiSbm6SR Qwsw== Received: by 10.152.108.38 with SMTP id hh6mr12996318lab.28.1340114672672; Tue, 19 Jun 2012 07:04:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.86.133 with HTTP; Tue, 19 Jun 2012 07:04:12 -0700 (PDT) In-Reply-To: References: From: Kevin Sutter Date: Tue, 19 Jun 2012 09:04:12 -0500 Message-ID: Subject: Re: Timestamp precision question. To: users@openjpa.apache.org Content-Type: multipart/alternative; boundary=bcaec54eef2005decb04c2d3c324 X-Virus-Checked: Checked by ClamAV on apache.org --bcaec54eef2005decb04c2d3c324 Content-Type: text/plain; charset=ISO-8859-1 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: 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 > >> > --bcaec54eef2005decb04c2d3c324--