-->
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: Date object and constructor expressions
PostPosted: Wed Oct 12, 2011 5:25 am 
Newbie

Joined: Wed Apr 19, 2006 12:50 pm
Posts: 8
hi
I was recently using constructor expressions in my hql queries and was supprised to see that selecting a field in an entity in this way of type java.sql.Date returned me an object of type java.util.Date. Have anybody else encountered this issue..? or can somebody explain me why this is the expected behaviour, if thats the case..?

cheers
Rasmus


Top
 Profile  
 
 Post subject: Re: Date object and constructor expressions
PostPosted: Wed Oct 12, 2011 9:30 am 
Newbie

Joined: Wed May 11, 2011 6:36 pm
Posts: 8
could you explain the way you checked that?

java.sql.Date does inherit java.util.Date; if you checked "the wrong way" (instanceof for example) you get true and its still ok.


Top
 Profile  
 
 Post subject: Re: Date object and constructor expressions
PostPosted: Mon Oct 17, 2011 2:53 pm 
Newbie

Joined: Wed Apr 19, 2006 12:50 pm
Posts: 8
hi Laures
thanks for your reply. I just started out making a DTO object taking a java.sql.Date as constructor argument. As i got an error indicating a type error, i then tried with java.util.Date and it worked like a charm - this was nice as i made it work but i would just like to understand it as well, since it seems a bit strange to me as entity field is defined as java.sql.Date.

best regards
Rasmus


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.