Skip site navigation (1) Skip section navigation (2)

Re: Hibernate, JBoss, PostgreSQL, timestamp read doesn't match during update

From: Roland Roberts <roland(at)astrofoto(dot)org>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Hibernate, JBoss, PostgreSQL, timestamp read doesn't match during update
Date: 2009-03-20 23:56:18
Message-ID: 49C42D22.2010101@astrofoto.org (view raw or flat)
Thread:
Lists: pgsql-jdbc
Oliver Jowett wrote:
> Roland Roberts wrote:
>   
>> Oliver Jowett wrote:
>>     
>>> Roland Roberts wrote:
>>>  
>>>       
>>>> Yes, restrict the timestamp to millisecond precision.  Somewhere the
>>>> sub-millisecond parts are getting lost.  I have no idea if it is in the
>>>> JDBC layer or somewhere in Hibernate.  Any clues on figuring this out?
>>>>         
>>> Is the server built with integer_datetimes? Maybe you are just hitting a
>>> rounding problem.
>>>       
>> Which server; do you mean PostgreSQL or JBoss?  I think you mean JBoss,
>> but I'm not sure how to check on that.  If you know, please share.  I'll
>> see what I can find out.
>>     
> No, I mean the PostgreSQL server.
>   
roland=# show integer_datetimes;
 integer_datetimes
-------------------
 off
(1 row)

When I use a trigger to set the timestamps, they show up with 
microsecond precision.  The problem is that the extra precision is 
definitely getting lost before Hibernate tries to put the value back.  
The update looks more-or-less like

update mytable set col1=val1 where primary_key = pkval and 
some_timestamp = timestamp_value

timestamp_value doesn't match what is in the database even though it was 
retrieved by an earlier query.

I've got some more poking I can do.  Java doesn't seem to have a way of 
printing microseconds for timestamps with, for example, 
SimpleDateFormat, but I should be able to see if it can at least 
retrieve them.

roland

-- 
		       PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD                             RL Enterprises
roland(at)rlenter(dot)com                            6818 Madeline Court
roland(at)astrofoto(dot)org                           Brooklyn, NY 11220


In response to

Responses

pgsql-jdbc by date

Next:From: Roland RobertsDate: 2009-03-21 00:05:46
Subject: Re: Hibernate, JBoss, PostgreSQL, timestamp read doesn't match during update
Previous:From: Oliver JowettDate: 2009-03-20 23:38:58
Subject: Re: Hibernate, JBoss, PostgreSQL, timestamp read doesn't match during update

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group