-->
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: Possible BUG with Date during query
PostPosted: Wed Jan 04, 2006 12:03 am 
Newbie

Joined: Thu Mar 17, 2005 2:06 pm
Posts: 12
I have an object with a Date field. The hibernate maps this object to a java.util.Date. My object also has a compareTo function, which sorts itself by date.

When the compareTo function is called, there is an error: java.lang.ClassCastException: java.util.Date at java.sql.Timestamp.compareTo

because Hibernate passed in a java.sql.Timestamp.

The compiler allows this because Timestamp extends Date - HOWEVER - the documentation explains this is implementation inheritance not type enheritance, and so code should not view Timestamp values generically as an instance of java.util.Date.

If I specify java.util.Date in my hibernate mapping file, I should not receive a java.sql.Timestamp.


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.