The most common place this happens is using relationship setters and passing an array of entities to sync to an unloaded entity, like so:
post.create( {
"title": "Some title",
"body": "Some post body",
"tags": [ "foo", "bar" ] // this will fail
} );
It needs to be
post.create( {
"title": "Some title",
"body": "Some post body"
} );
post.tags().attach( [ "foo", "bar" ] );
We could try to do some magic by adding a postInsert hook and attaching the tags there, but it seems to approach the problem of Hibernate where it did too much for you. I think I'd rather just throw a helpful error message that points the user to saving then calling attach separately. I also like how it accurately shows that this will take two queries because that is what would happen if we did it automagically.