Reputation: 14044
I'm a bit confused, I was under the impression that classes will only need to implement serializable, well, if I need to serialize them (as in, hibernate doesn't require classes to be serializable if all I want is persistance)
Anyways, the following got me a bit confused. I have a class, lets call it A. Which have a one to one relation to another class. Lets call it B.
I have now added another one-to-one relation to class C as well, and now, I get a run time exception when i use mySession.get(A.class, myid), telling me that C cant be cast to Serializable
I cant make any sence of why C needs to have serializable implemented when none of my other hibernate classes needs it.
Update
Another weird thing is, this mapping have actually worked without the "C" class being serializable in the past.
I did a manual change of the data inside the table though, using the mysql client. I ran a update which converted all strings in the table to uppercase using the UPPER() function. Could this have been what made hibernate want the class to be serializable now?
Upvotes: 0
Views: 737
Reputation: 3583
that error is common when you forgot make the mapping to a persisting object of your class,
for example you have a persisting class User inside have another persisting class Address, Address is mapped to but in User you forgot make the relation one to one then you mapped as Basic type
check you code for any forgiven mapping of relationship
Upvotes: 2