[Logo]
Forums Register Login
ClassCastException while inserting record using Hibernate
I have UserDomain class corresponding to table user_domain and having fields userId and domainId.

In a function I have following code:



When I run this code, passing questionId and doaminId as arguments to the function, I am getting exception
java.lang.ClassCastException: java.lang.String
at this line:


What can be the reason for this exception?

Thanks in advance

[ May 19, 2008: Message edited by: Pranav Pal ]

[ May 19, 2008: Message edited by: Pranav Pal ]
[ May 19, 2008: Message edited by: Pranav Pal ]
What are the id types in Java and what hibernate types do you have in your mapping for those ids? Sounds like in one case it is a String and another it is a long or an int.

Mark
You'll never get away with this you overconfident blob! The most you will ever get is this tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss


This thread has been viewed 762 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jul 19, 2018 15:23:27.