We're upgrading from Hibernate 4.3.11 to Hibernate 5.2.7 and are getting a NullPointerException in ModelBinder when it tries to access a PrimaryKey. It's null.
We have a mix of HBM and Annotation entities. It happens when an entity is mapped via XML and references an entity that is mapped via annotations - many to one. We're using the legacy bootstrapping process via spring's LocalSessionFactoryBuilder (version 5). I've tried changing to non-legacy native bootstrapping, but that made no difference.
Here's the exception:
NPE in ModelBinder
Originally posted here: https://forum.hibernate.org/viewtopic.php?f=1&t=1044033
I worked around it in the short-term by changing ModelBinder to create the primary key on-demand if it doesn't exist. https://github.com/rtennantventuretech/hibernate-orm/commit/c2bf4b808259c8a56bc494ece7a4ba50874793ec