Bug 109 : setLoaded() on embedded beans not called after update (to allow further updates)
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
1.2.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
30/04/2009
Updated 
30/04/2009
Type 
Bug
 
Attachments 
No attachments

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.

 
Rob 08 May 07:03
Fixed in HEAD

Fixed in HEAD.

The entity beans are enhanced now to call setEmbeddedLoaded() on each of their embedded beans.

woResponse

Upload a file