I have this problem..
I have a Hashmap containing the String as the key and Object as the value. I have one Date Object inside it…
While setting in the value for stored procedure call to DB I want to convert it to sql Date type..
Code Snippet..
this.cStmt.setDate(15,(java.sql.Date) (SubsProfile.get(Constants.SUBSC_DETAILS_EXPIRY_DATE_1)));
However while running I am getting ClassCastException..
Exception:-
java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Date
please help me to convert it to appropiate type…
that’s because, as the exception says, your object is java.util.Date, and you’re casting it to java.sql.Date!
Do this: