The attached (simple) test-case triggers a NullPointerException when creating the 2nd-level cache key for an entity in EntityUpdateAction.doAfterTransactionCompletion.
The bug seems to be present since DelayedPostInsertIdentifier handling changed in HHH-11019 Closed .
In previous versions (5.2.x), DelayedPostInsertIdentifiers were not used in this use-case.
The root-cause of the problem seems to be that org.hibernate.action.internal.EntityAction#getId will return null in some use-cases, but org.hibernate.cache.spi.support.AbstractEntityDataAccess#generateCacheKey cannot handle that.
Also tested with 5.4.0-CR2: the bug is still present in that version.