Hibernate throws "org.hibernate.id.IdentifierGenerationException: attempted to assign id from null one-to-one property"

The issue is that the @OneToOne association is null. This is because you didn’t resolve it properly when building the entity from the JSON object.

So, either the Order object has a null compensation association or the Compensation object has a null order association.

Either way, you need to make sure you set both sides of the bidirectional association using real entities.