-->
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.  [ 3 posts ] 
Author Message
 Post subject: Domain Objects returning Timestamp (Expecting Just Date) HB3
PostPosted: Thu Oct 21, 2004 12:37 pm 
Newbie

Joined: Thu Oct 21, 2004 12:12 pm
Posts: 2
I am experiencing some differences between version 2.1 and 3.0A data mapped fields. It seems that my mapping, although defined as java.util.Date, returns java.sql.Timestamp. The Java2 API suggests that Date and Timestamp objects should never be compared. So, two questions,

1. Will Hibernate 3.0 now return java.sql.Timestamps for properties mapped as Date

2. What is the best practice when dealing with returned java.sql.Timestamps when it is necessary to compare dates in the applications layer.

Thanks!


Hibernate version: 3.0A[\b]

[b]Mapping documents:[\b]

<property
name="effectiveDate"
type="java.util.Date"
update="true"
insert="true"
access="field"
column="EFFECTIVE_DATE"
/>

[b]Name and version of the database you are using:

Oracle9i Enterprise Edition Release 9.2.0.5.0


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 21, 2004 2:00 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Both Hibernate2 and Hibernate3 use TimestampType to handle properties typed as "java.util.Date". They both handle this exactly the same way.

What exacctly is the "difference" you see?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 21, 2004 5:08 pm 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
Steve, that's actually my bad as I would have bet money that when we sucked a date out of the DB through Hibernate that it ended up as a java.sql.Date.

We're starting to see some different behaviour between 2 and 3, i.e. code involving dates that used to work no longer does.

One of the most significant was some of our composite keys blowing an exception saying that TimeStamps can't be part of a primary key when a week earlier they were working fine.

We'll have to go back to the well to see what's up, I'm not convinced we've ever had our Date types set up 100% correctly.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.