You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Andrus Adamchik <an...@objectstyle.org> on 2007/09/11 15:24:10 UTC

Re:

Note that until you call 'context.commitChanges()', none of your  
local changes will be saved to DB.

But I wonder why would the UI modify the objects if it does not  
intend to commit them back to the DB?

Are you talking about modifying the list, not the objects themselves?  
If so - you can modify the list returned from the query in any way  
you want (reorder, add/remove objects, etc.) - there's no persistence  
implications. But if you got a list from to-many relationship though,  
I would recommend to clone it before modification. E.g.:

List list = new ArrayList(artist.getPaintings());

Cheers,
Andrus


On Sep 11, 2007, at 4:08 PM, taiq hashash wrote:
> hi ,
>
> i have one question, the ORM ease up the database relations so u  
> dont have to interact with it but the return object (ORM) is linked  
> to the database so if i changed anything on the return objects List  
> when i do a select query it will be reflected on the database , so  
> all i want to do is just list the data but without any risk of  
> having my data to be compremized . the solution could be thet i  
> take the List of objects and create with it another List of Objects  
> that are not releational with the database and send it back to the  
> presintation tier . but i dont want to generate a huge number of  
> classes , so my question is :
>
> is there a way to disbound the List of object which is returned by  
> cayenne so it would be safe to be sent to the presentation layer????
>
> thank you