Emanuel Kupcik commented on Bug HHH-7377

Is there any chance that this gets fixed any time soon? It makes natural IDs a bit useless to me.

An obvious fix would be a simple check for null but I have no idea whether that is really the right place to handle this.

for ( Serializable pk : getPersistenceContext().getNaturalIdHelper().getCachedPkResolutions( entityPersister ) ) {
	final EntityKey entityKey = generateEntityKey( pk, entityPersister );
	final Object entity = getPersistenceContext().getEntity( entityKey );
	final EntityEntry entry = getPersistenceContext().getEntry( entity );
	
 	// would this already be enough to fix it?
	if(entry == null) {
		continue;
	}

	if ( !entry.requiresDirtyCheck( entity ) ) {
		continue;
	}

	// MANAGED is the only status we care about here...
	if ( entry.getStatus() != Status.MANAGED ) {
		continue;
	}

	getPersistenceContext().getNaturalIdHelper().handleSynchronization(
			entityPersister,
			pk,
			entity
	);
}
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira