Does save() check the object is dirty / persisted?

0 views
Skip to first unread message

Clarkee21

unread,
Dec 16, 2009, 5:38:02 PM12/16/09
to transfer-dev
Hi there,

Couldn't find this in the documentation.

Does the Transfer save() function check the object for changes before
actually saving it?

The reason I ask is because I've got a loop going on in my code which
goes over some "User" Objects. The thing is I want to know if I can
just pass them all through to save() to be dealt with (hopefully not
saving the ones that don't need it) or do I need to check them with
isDirty() or getIsPersisted() before I pass it through?

Would be great if save() does as it would shrink my code down a
bit :-)

Thanks a lot,
James

Bob Silverberg

unread,
Dec 16, 2009, 5:42:39 PM12/16/09
to transf...@googlegroups.com
I'm pretty sure that Transfer won't save them unless it thinks their
dirty, but I could be wrong about that.

It would be pretty easy to test, though. Just try it and observe the
SQL that is generated. ;-)

Sent from my iPhone
> --
> Before posting questions to the group please read:
> http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer
>
> You received this message because you are subscribed to the Google
> Groups "transfer-dev" group.
> To post to this group, send email to transf...@googlegroups.com
> To unsubscribe from this group, send email to transfer-dev...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/transfer-dev?hl=en

Mark Mandel

unread,
Dec 16, 2009, 5:49:23 PM12/16/09
to transf...@googlegroups.com
http://docs.transfer-orm.com/wiki/Persisting_and_Retrieving_Objects.cfm#Transfer.update(transferObject%2C_[useTransaction])

Quote: "This method updates the details of a TransferObject within the database, if the details of the object have been changed since it was last committed to the database. "

Mark
--
E: mark....@gmail.com
T: http://www.twitter.com/neurotic
W: www.compoundtheory.com

Clarkee21

unread,
Dec 16, 2009, 6:13:57 PM12/16/09
to transfer-dev
Thanks guys. I did think it was an obvious question, thanks for
pointing me in the right direction though :-)

Cheers,
James

On Dec 16, 10:49 pm, Mark Mandel <mark.man...@gmail.com> wrote:
> http://docs.transfer-orm.com/wiki/Persisting_and_Retrieving_Objects.c...[useTransaction])
>
> Quote: "This method updates the details of a TransferObject within the
> database, if the details of the object have been changed since it was last
> committed to the database. "
>
> Mark
>
> On Thu, Dec 17, 2009 at 9:42 AM, Bob Silverberg <bob.silverb...@gmail.com>wrote:
>
>
>
> > I'm pretty sure that Transfer won't save them unless it thinks their
> > dirty, but I could be wrong about that.
>
> > It would be pretty easy to test, though. Just try it and observe the
> > SQL that is generated. ;-)
>
> > Sent from my iPhone
>
> > On 2009-12-16, at 5:38 PM, Clarkee21 <clarke...@gmail.com> wrote:
>
> > > Hi there,
>
> > > Couldn't find this in the documentation.
>
> > > Does the Transfer save() function check the object for changes before
> > > actually saving it?
>
> > > The reason I ask is because I've got a loop going on in my code which
> > > goes over some "User" Objects. The thing is I want to know if I can
> > > just pass them all through to save() to be dealt with (hopefully not
> > > saving the ones that don't need it) or do I need to check them with
> > > isDirty() or getIsPersisted() before I pass it through?
>
> > > Would be great if save() does as it would shrink my code down a
> > > bit :-)
>
> > > Thanks a lot,
> > > James
>
> > > --
> > > Before posting questions to the group please read:
>
> >http://groups.google.com/group/transfer-dev/web/how-to-ask-support-qu...
>
> > > You received this message because you are subscribed to the Google
> > > Groups "transfer-dev" group.
> > > To post to this group, send email to transf...@googlegroups.com
> > > To unsubscribe from this group, send email to
> > transfer-dev...@googlegroups.com
> > > For more options, visit this group at
> >http://groups.google.com/group/transfer-dev?hl=en
>
> > --
> > Before posting questions to the group please read:
>
> >http://groups.google.com/group/transfer-dev/web/how-to-ask-support-qu...
>
> > You received this message because you are subscribed to the Google Groups
> > "transfer-dev" group.
> > To post to this group, send email to transf...@googlegroups.com
> > To unsubscribe from this group, send email to
> > transfer-dev...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/transfer-dev?hl=en
>
> --
> E: mark.man...@gmail.com
Reply all
Reply to author
Forward
0 new messages