The following NullPointerException occurs when iterating on a List of object loaded by Hibernate:
My field declaration is:
The setter method in which the NPE occurs:
NPE occurs during a call on the Session.merge method:
The getSession() method is a utility method which create a new Session from the SessionFactory.
After taking a look at the org.hibernate.engine.internal.StatefulPersistenceContext code, it seems that the problem comes from:
The CollectionEntry ce returned by getCollectionEntry is null.
Windows 7, MySQL 5.6.25-enterprise-commercial-advanced, connectorJ driver, Java version 1.8.0_131