Below code throws a casting error
Long newID = (Long)session.save(object);
I am new to hibernate. Don't know why.
The return value of session.save()
depends on your mapping. Most likely you have a type of ID that isn't a Long. Try doing this:
System.out.println(session.save(object).getClass().getName());
Then you'll see the type name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With