-->
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.  [ 1 post ] 
Author Message
 Post subject: Map a Java Date to a Postgres Timestamp?
PostPosted: Thu Mar 03, 2011 7:28 pm 
Regular
Regular

Joined: Thu Aug 28, 2003 2:42 pm
Posts: 77
Location: The Netherlands
How can I map a Java Date to a Postgres Timestamp and visa versa?

I don't want Hibernate to map Java Date to Postgres Date as the latter one has not seconds details, and I don't want Hibernate to return a Java Timestamp as that's the worse Java object there exists :( So I can't use the timestamp hibernate type as then it would return a Java Timestamp from the db.
BTW: I don't need the nanosecond part in Timestamp...

I did define define a Date -> timestamp mapping in the Postgres Dialect and did define it in the hibernate properties file.
But for some reason, Hibernate still returns a Java Timestamp object. No idea why ... I get the feeling it's returned by the Jdbc driver and Hibernate will leave it like that as it's subclass of the Date object ...

How to solve this ?
- Ed


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

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.