|
Unfortunately I am not able to persuade Hibernate to use field access for my embedded object (moving @Embedded to field or adding @AccessType doesn't help). But using common sense it can not work with that.
Also I have a small modification to the workaround - we will use a bit more semantically correct version (instead of ignoring null value, we will interpret it as a "empty object"):
public void setMyEmbeddedObject(MyEmbeddedObject myEmbeddedObject) {
this.myEmbeddedObject = (myEmbeddedObject != null) ? myEmbeddedObject : new MyEmbeddedObject();
}
|