Updating reference to entity, not fields of referenced entity

I have Document entity, and Company entity. Each document belongs to some company.

    @ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.MERGE, CascadeType.PERSIST }, targetEntity = Organization.class)
    private Organization org;

Document can be sent to BPM engine, and can be returned from BPM engine as serialized data, than deserialzed back to entity object and persisted/merged in entity manager.

So, when I call merge method I get error:

java.lang.IllegalStateException: org.hibernate.TransientPropertyValueException: object references an unsaved transient instance - save the transient instance before flushing : my.app.models.Organization.orgType -> my.app.models.OrgType

It’s because company hibernate treat document as detached object and tries to save all entities with child entities. But I don’t want to save OrgType. More, I don’t want to save changes in company, because it may be a security issue - users can’t change companies or company types. But if changes companyId in document - I want to save Document.Org reference in db.

So, I need to implement “update only id reference, if referenced entity changes”.

What is the most simple way to do it?