-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 
Author Message
 Post subject: Driver with Types.TIMESTAMP_WITH_TIMEZONE
PostPosted: Fri Nov 25, 2016 12:39 pm 
Newbie

Joined: Wed Dec 16, 2015 8:09 am
Posts: 14
pgjdbc currently maps the TIMESTAMP WITH TIME ZONE SQL type to the java.sql.Types.TIMESTAMP JDBC type. We are currently discussing whether we should instead map it to the java.sql.Types.TIMESTAMP_WITH_TIMEZONE JDBC for the JDBC 4.2 driver. We are unsure whether this would break Hibernate (assuming calling #getTimestamp would still work). Searching for references to TIMESTAMP_WITH_TIMEZONE we didn't find anything.

Is there a way to run the Hibernate test suite for PostgreSQL with a locally built SNAPSHOT version of the driver?


Top
 Profile  
 
 Post subject: Re: Driver with Types.TIMESTAMP_WITH_TIMEZONE
PostPosted: Fri Nov 25, 2016 4:11 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
The PostgreSQL Dialect maps the JDBC TIMSTAMP Type to the DB timestamp type. Why do you want to map TIMESTAMP WITH TIMEZONE?


Top
 Profile  
 
 Post subject: Re: Driver with Types.TIMESTAMP_WITH_TIMEZONE
PostPosted: Fri Nov 25, 2016 4:33 pm 
Newbie

Joined: Wed Dec 16, 2015 8:09 am
Posts: 14
We do not want to change anything with the DB timestamp type.

For the "timestamptz" database type (TIMESTAMP WITH TIME ZONE) pgjdbc meta data currently reports java.sql.Types.TIMESTAMP as a JDBC type. We discuss reporting java.sql.Types.TIMESTAMP_WITH_TIMEZONE instead in this case. It currently doesn't seem to be mapped.


Top
 Profile  
 
 Post subject: Re: Driver with Types.TIMESTAMP_WITH_TIMEZONE
PostPosted: Sat Nov 26, 2016 1:59 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
You can always extend the current PostgreSQL Hibernate Dialect and overwrite the JDBC Type for a given column type.


Top
 Profile  
 
 Post subject: Re: Driver with Types.TIMESTAMP_WITH_TIMEZONE
PostPosted: Sat Nov 26, 2016 4:11 am 
Newbie

Joined: Wed Dec 16, 2015 8:09 am
Posts: 14
Yes, but we would like to know if this driver change would have an impact for existing Hibernate users.


Top
 Profile  
 
 Post subject: Re: Driver with Types.TIMESTAMP_WITH_TIMEZONE
PostPosted: Sat Nov 26, 2016 6:22 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
When you say existing Hibernate users, you mean your the users that access you current application, right?


Top
 Profile  
 
 Post subject: Re: Driver with Types.TIMESTAMP_WITH_TIMEZONE
PostPosted: Sat Nov 26, 2016 1:21 pm 
Newbie

Joined: Wed Dec 16, 2015 8:09 am
Posts: 14
With existing Hibernate users I mean everyone who uses Hibernate with pgjdbc.


Top
 Profile  
 
 Post subject: Re: Driver with Types.TIMESTAMP_WITH_TIMEZONE
PostPosted: Sat Nov 26, 2016 2:02 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
I think there was a misunderstanding.

I didn't say we plan on changing the current PosgreSQL Dialects to support TIMESTAMP WITH TIMEZONE.

I said that you should extend the Hibernate Dialect, defining your own Dialect which maps the JDBC Timsetamp to TIMESTAMP WITH TIMEZONE. So, it's just your application that will use your custom Dialect.


Top
 Profile  
 
 Post subject: Re: Driver with Types.TIMESTAMP_WITH_TIMEZONE
PostPosted: Mon Nov 28, 2016 3:56 pm 
Newbie

Joined: Wed Dec 16, 2015 8:09 am
Posts: 14
I as well believe there is a misunderstanding :-)

We are discussing to change the pgjdbc driver upstream. So any Hibernate user would get that change sooner or later. We would like to know if this change in the driver itself would negatively affect Hibernate users.


Top
 Profile  
 
 Post subject: Re: Driver with Types.TIMESTAMP_WITH_TIMEZONE
PostPosted: Tue Nov 29, 2016 12:41 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
I'm going to ask this question internally to see what the other Hibernate Developers think of this Driver change.

From all the PostgreSQL references I found, it seems like everyone is suggesting to use TIMESTAMPZ instead of TIMESTAMP, so I guess this change is understandable.

From my perspective, this change will not just affect Hibernate users, but every JDBC framework that uses PostgreSQL. We also added a hibernate.jdbc.time_zone configuration property, so that our users can force all Timestamps to be saved in a given TimeZone, typically UTC.

I'm feeling anxious about this change since JDBC only offers a TIMESTAMP type. JDBC does not make a difference from TIMESTAMP and TIMESTAMP ith TIMEZONE, and not all DBs support this concept. For instance, MySQL makes the conversation automatically and saves all timestamps in UTC. But then, this is probably how TIMESTAMPZ works in PostgreSQL too.

I'm going to ask this question on Twitter as well to gather more feedback from our community as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.