jQuery in Action, 3rd edition
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate: java.lang.ClassCastException: java.util.GregorianCalendar" Watch "Hibernate: java.lang.ClassCastException: java.util.GregorianCalendar" New topic

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

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436

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: 57
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
It's not a secret anymore!