-->
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: Problem with persisting XML data
PostPosted: Mon Oct 10, 2005 9:49 pm 
Newbie

Joined: Mon Oct 10, 2005 7:24 pm
Posts: 4
Hi,
I am mapping XML element to database. Facing problem in persisting date property. In XML String date is coming in the format 'yyyy-MM-ddTHH:mm:ss.SSSz'. My POJO and XDoclet for timestamp is as follows:
/**
* @hibernate.property properties-name="UNIQUE_EVENT_KEY" type="java.util.Date" not-null="false" column="SERVERTIMESTAMP" node="SERVERTIME"
*/
public Date getEventTime() {
return eventTime;
}

[b]Hibernate has org.hibernate.type.TimestampType class whic has hardcoded time format as yy-MM-dd HH:mm:ss. So if my XML has this format it works else give parse exception. Is there is way to provide date format ?[/b]

[b]Source Code from TimestampType[/b]
/**
* <tt>timestamp</tt>: A type that maps an SQL TIMESTAMP to a Java
* java.util.Date or java.sql.Timestamp.
* @author Gavin King
*/
public class TimestampType extends MutableType implements VersionType, LiteralType {

private static final String TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss";

[b]Exception:[/b]
could not parse XML; nested exception is org.hibernate.HibernateException: could not parse XML
org.hibernate.HibernateException: could not parse XML
at org.hibernate.type.TimestampType.fromStringValue(TimestampType.java:124)
at org.hibernate.type.NullableType.fromXMLString(NullableType.java:102)
at org.hibernate.type.NullableType.fromXMLNode(NullableType.java:126)


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.