ClassCastException on DOM4J replicate of Calendar property

Description

If you attempt to replicate() an object that has a property of type Calendar (calendar_date), you get a ClassCastException.

I loathe jumping to conclusions, but I am guessing it is happening on line 54 of CalendarDateType.java, which looks like this:
result.setTime( ( (Date) Hibernate.DATE.fromStringValue(xml) ) );

(note that "Date" is java.sql.Date, and the thing that is being created on the right is a java.util.Date).

Muchas Gracias
-Dave
------------------------------------------------
[java] Hibernate: select id from donut where id =?
[java] java.lang.ClassCastException
[java] at org.hibernate.type.CalendarDateType.fromStringValue(CalendarDateType.java:54)
[java] at org.hibernate.type.NullableType.fromXMLString(NullableType.java:149)
[java] at org.hibernate.type.NullableType.fromXMLNode(NullableType.java:173)
[java] at org.hibernate.property.Dom4jAccessor$ElementGetter.get(Dom4jAccessor.java:194)
[java] at org.hibernate.property.Dom4jAccessor$Dom4jGetter.getForInsert(Dom4jAccessor.java:9
4)
[java] at org.hibernate.tuple.AbstractEntityTuplizer.getPropertyValuesToInsert(AbstractEntit
yTuplizer.java:264)
[java] at org.hibernate.persister.entity.AbstractEntityPersister.getPropertyValuesToInsert(A
bstractEntityPersister.java:3328)
[java] at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractS
aveEventListener.java:244)
[java] at org.hibernate.event.def.DefaultReplicateEventListener.onReplicate(DefaultReplicate
EventListener.java:117)
[java] at org.hibernate.impl.SessionImpl.fireReplicate(SessionImpl.java:854)
[java] at org.hibernate.impl.SessionImpl.replicate(SessionImpl.java:848)
[java] at DonutTest.reconstitute(DonutTest.java:57)
[java] at DonutTest.main(DonutTest.java:35)

Environment

Hibernate 3.1, mysql

Attachments

Assignee

GavinG

Reporter

David Tashima

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure