My test uses the same instance of the loaded bean to update a property within an embedded bean - and now fails as when Ebean calls EntityBeanIntercept.setLoaded only the oldValues of the main bean are nulled, but not those of any embedded bean.
Pseudo code:
bean = Query.findUnique()
bean.embedded.property=A; // previous null
Ebean.save(bean)
bean.embedded.property=B
Ebean.save(bean) //fails as the "where" in the "update" still uses "null" for bean.embedded.property instead of "A" as the oldValues of the embedded bean have not been "null"ed via the PersistRequestBean.postExecute and the intercept().setLoaded() there.
I easily could provide a patch which iterates through the embedded beans of the entity-bean and call setLoaded() on them, but shouldn't the setLoaded() method itself call setLoaded() on the embedded beans? Which might require some changes to the interceptor to get these informations - and avoiding lazy initialization.
Fixed in HEAD.
The entity beans are enhanced now to call setEmbeddedLoaded() on each of their embedded beans.