thanks. this clarifies this for me.  it would be great to not have to
update both sides when a property is read only.  i always thought read
only properties could act more like custom fill queries with the
mappedBy property as a fill parameter, but possibly that would not be
best practice.  - kevin

--- In [email protected], "Jeff Vroom" <[EMAIL PROTECTED]> wrote:
>
> Yeah, when you have a bi-directional association like this, you need to
> update both sides of the association.  In other words, you do still have
> to update the read-only phones property in this case.   The read-only
> attribute is kind of misleading... you do still have to update those
> properties, it is just that the assembler does not use those properties
> for persisting in the database.  If you don't update them, the cached
> copies won't be updated.
> 
>  
> 
> Jeff
> 
>  
> 
> ________________________________
> 
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of Kevin
> Sent: Monday, March 31, 2008 9:53 AM
> To: [email protected]
> Subject: [flexcoders] LCDS proper way to commit read-only properties
> 
>  
> 
> I am trying to figure out the right way to do this. I have a
> ContactVO which has a phones collection that is mapped as a read-only
> association. In Hibernate we are using the mappedBy annotation and in
> the database we have a contact_id columns which joins the ContactVO to
> the PhoneVO table.
> 
> My actionscript ContactVO has a "contact.phones" collection which we
> bind to a datagrid. It seems that if I do this when I create a new
> PhoneVO:
> 
> ds = new DataService("phones");
> ds.createItem(myNewPhoneVO);
> 
> ..the PhoneVO is persisted in the database BUT the "phones" collection
> in my ContactVO is not updated. However, if I refresh the application
> OR refill my contacts collection then the new PhoneVO shows up as
> expected. It seems as if one uses "createItem" on a read only
> property then the associated collection does not get the pushed data.
> Is this the expected behavior? 
> 
> If so, it seems like I would have to always add the item to my
> collection in order to persist it correctly. Is that the "right" way
> to commit these read-only collections?
> 
> Thanks, Kevin
>


Reply via email to