You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by taiq hashash <dm...@hotmail.com> on 2007/09/11 15:08:50 UTC

(Unknown)

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
_________________________________________________________________
Can you find the hidden words?  Take a break and play Seekadoo!
http://club.live.com/seekadoo.aspx?icid=seek_wlmailtextlink

Re:

Posted by Malcolm Edgar <ma...@gmail.com>.
Hi Taiq,

this is more of a Hibernate session flushing (commit) issue. As said before
unless you explicitly commit the data context associated with the queried
objects, the database will not be updated.

If you are worried about accidental changes, I would recommend that you
create a new DataContext for each web request.

regards Malcolm Edgar

On 9/11/07, Michael Gentry <bl...@gmail.com> wrote:
>
> Hi Taiq,
>
> I've used Cayenne in a web application and if you are just wiring it
> up for display (read-only, no input fields/etc), then there is not an
> issue.  If you are wiring it up to actual inputs, I'd think you'd want
> to be able to capture those changes to do a
> dataContext.commitChanges().  If you don't commit the changes, they
> still won't be committed to the database even if the user changes the
> data.
>
> Hope that helps...
>
> /dev/mrg
>
>
> On 9/11/07, taiq hashash <dm...@hotmail.com> 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
> > _________________________________________________________________
> > Can you find the hidden words? Take a break and play Seekadoo!
> > http://club.live.com/seekadoo.aspx?icid=seek_wlmailtextlink
>

Re:

Posted by Michael Gentry <bl...@gmail.com>.
Hi Taiq,

I've used Cayenne in a web application and if you are just wiring it
up for display (read-only, no input fields/etc), then there is not an
issue.  If you are wiring it up to actual inputs, I'd think you'd want
to be able to capture those changes to do a
dataContext.commitChanges().  If you don't commit the changes, they
still won't be committed to the database even if the user changes the
data.

Hope that helps...

/dev/mrg


On 9/11/07, taiq hashash <dm...@hotmail.com> 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
> _________________________________________________________________
> Can you find the hidden words? Take a break and play Seekadoo!
> http://club.live.com/seekadoo.aspx?icid=seek_wlmailtextlink

Re:

Posted by Andrus Adamchik <an...@objectstyle.org>.
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