From: | Dave Cramer <pg(at)fastcrypt(dot)com> |
---|---|
To: | Gil G <gm12345678(at)gmail(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: TimestampUtils.loadCalendar failes for interval type |
Date: | 2005-09-11 23:11:49 |
Message-ID: | A9ED690D-5F22-4D5B-870A-37913B688F95@fastcrypt.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
I would suggest you send a bug note to Hibernate. An inteval is not a
timestamp, nor can it be construed as such.
Dave
On 8-Sep-05, at 7:26 AM, Gil G wrote:
> Hi,
>
> I've executed following query:
> select t.date-t.date2 from table as t
>
> The query should return a single row of type interval. Indeed,
> resultSet.getObject(1) returns a PGInterval instance with the
> correct value (the returned interval is 2 days and several hours).
>
> When I call resultSet.getString(1) the string representation of
> interval is "2 days 14:08:55.8246".
> The problem arises when I call resultSet.getTimestamp(1).
> As I saw in org.postgresql.jdbc2.TimestampUtils.loadCalendar
> (GregorianCalendar cal, String s, String type) it fails to parse
> correctly
> the string, which is returned by resultSet.getString(1) call. since
> it expects only the "14:08:55.8246" part and does not expect the "2
> days " part. Please note that in case the interval between two
> dates is smaller than 24 hours everything works correctly.
>
> This is important since, generic products such as Hibernate that
> work over different jdbc drivers, refer to the interval data type
> as a java.sql.Timestamp object and call getTimestamp(int) method
> on the resultset to get the instance.
>
> Thanks,
> Gil
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Jowett | 2005-09-11 23:13:17 | Re: TimestampUtils.loadCalendar failes for interval type |
Previous Message | Vadim Nasardinov | 2005-09-09 15:11:39 | Re: Two millisecond timestamp offset |