Thursday, 2 October 2014

Hibernate - annotation mappings and misleading SerializationException

Took me a few hours to get to the bottom of this.
I was getting the following Exception, which did not make sense as the deSerialization test passed OK.
I have a domain object that I had proved through a unit test that I could serialize & deserialize successfully.


My domain object contained the following object which if I removed then worked OK:


But tomcat & my integration test were both failing with the following Exception.


It turns out I had missed out an annotation, obvious really but I could not spot the error & the Exception was totally misleading. What had I missed? The '@manyToOne' annotation. Twit.