-->
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: XML format of Date type
PostPosted: Wed Jun 15, 2005 1:46 pm 
Beginner
Beginner

Joined: Wed Jun 15, 2005 1:28 pm
Posts: 39
Location: United States
Hibernate version:3.0
Source File involved: DateType.java
Methods involved: fromStringValue() and toString()

The string representation used for a property of type="date" is hard-coded as "dd MMMM yyyy".

When used with XML, these properties are never updatable unless the default locale of the JVM specifies the identical format.

When the server locale has a different pattern for dates, record level operations cause java.text.ParseException: Unparseable date.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 11, 2005 11:34 am 
Newbie

Joined: Thu May 13, 2004 8:13 am
Posts: 2
I hacked my copy of Hibernate by changing the method fromStringValue() so that the line
Code:
return new SimpleDateFormat().parse(xml);

becomes
Code:
return new SimpleDateFormat("dd MMMM yyyy").parse(xml);


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 11, 2005 12:18 pm 
Regular
Regular

Joined: Mon Sep 20, 2004 8:42 am
Posts: 58
Location: Boston, US
You should be aware of the Hibernate LGPL licencing implications if you're modifying the Hibernate source locally.

Sanjiv


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 11, 2005 3:09 pm 
Newbie

Joined: Thu May 13, 2004 8:13 am
Posts: 2
Right you are. Just had a look in CVS and this issue is already fixed.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 11, 2005 3:44 pm 
Regular
Regular

Joined: Mon Sep 20, 2004 8:42 am
Posts: 58
Location: Boston, US
It would be nice it the format of date in the XML could be parametrized. And if not, it should probably conform to the ISO 8601 representation just like the XML Schema dateTime datatype.

Sanjiv


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.