-->
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.  [ 5 posts ] 
Author Message
 Post subject: Problem reading Oracle date, formatting and extra 00:00:00
PostPosted: Mon Feb 25, 2008 8:31 pm 
Regular
Regular

Joined: Tue Feb 19, 2008 6:05 pm
Posts: 82
Currently I have a couple of date fields in my java objects that are mapped to equivalent date columns in Oracle database. Whenever, I read the dates, I always have to parse them and again reformat into the date format I need and it contains the time stamp 00:00:00 which I have to remove every time.

Is there an attribute like an sql-type or any other attribute that we can mention up front in the mapping file itself to read the date as is?

-Cheers
Rama


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 26, 2008 12:36 pm 
Senior
Senior

Joined: Fri Jun 01, 2007 12:41 pm
Posts: 121
Try with 'date' as column type in hibernate mapping. It returns only Date (with out time) for your column/property.

http://forum.hibernate.org/viewtopic.ph ... highlight=


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 26, 2008 5:26 pm 
Regular
Regular

Joined: Tue Feb 19, 2008 6:05 pm
Posts: 82
Hey thanks for the reply. I will try putting type="Date" in the mapping for every mapping of the date field and date column. I also realized that we anyways always have to parse :( the date whenever it is read before it is displayed or used anywhere.

Is it also possible to specify the formatting in the mapping file itself. We need the date format to be in the MM-dd-YYYY format rather than the oracle dd-MMM-YYYY format. Any suggestions?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 26, 2008 5:58 pm 
Senior
Senior

Joined: Fri Jun 01, 2007 12:41 pm
Posts: 121
Quote:
Is it also possible to specify the formatting in the mapping file itself. We need the date format to be in the MM-dd-YYYY format rather than the oracle dd-MMM-YYYY format. Any suggestions?


You can not dictate the date format in Oracle form Hibernate. You have to format the date as per your wish.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 26, 2008 8:26 pm 
Regular
Regular

Joined: Tue Feb 19, 2008 6:05 pm
Posts: 82
Oh ok. Looks like we have to get things done the hard way.

Thank you for your help.


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