aspose file tools
The moose likes Object Relational Mapping and the fly likes Hibernate: java.lang.ClassCastException: java.util.GregorianCalendar Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Hibernate: java.lang.ClassCastException: java.util.GregorianCalendar" Watch "Hibernate: java.lang.ClassCastException: java.util.GregorianCalendar" New topic
Author

Hibernate: java.lang.ClassCastException: java.util.GregorianCalendar

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 434
Hi,

I'm using Hibernate 3.3.2 .GA. I have a Java model in which one column of the model maps to an Oracle DATE column that can be null.



However, when I try and get results that include one of these columns with the null value,



I get the error below. Any ideas why? I have included the complete class below the stack trace.

Thanks, - Dave

Stack trace ...


Model class
Victor Dolirio
Ranch Hand

Joined: Aug 21, 2008
Posts: 56
I think that the problem is in this line:



As I guess that at least one of the variables startDate and endDate is of type GregorianCalendar. You must pass a Date once you have mapped it as a Date.

Try something like this:



Hope to help you.


If happen something bad in you life, don't ask God why it happened. Ask for what.
SCJP 5 (80%) - SCWCD 5 (91%) - SCBCD & SCJD coming soon...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate: java.lang.ClassCastException: java.util.GregorianCalendar
 
Similar Threads
Trouble setting criteria -- org.hibernate.TransientObjectException: object references an unsaved tra
Why is Hibernate creating a unique constraint when I don't want one?
Hibernate: Why is bag semantic getting applied when I'm not using Lists?
EntityManager.persist(obj) is not actually storing the object in Database
Duplicated rows on the database