Re: ERXGenericRecord call didUpdate on insert object

Daniele Corti <[email protected]> Tue, 10 Mar 2015 09:50:58 +0100
Newsgroups gmane.comp.web.webobjects.wonder-disc
Message-ID <CAJh8f29GBLD8ik8rLrmnccGe2gqKXAuF1MqxEGYMokVLtS7OvA@mail.gmail.com>
--===============6607654649593679539==
Content-Type: multipart/alternative; boundary=047d7beba2161d66ce0510eb4145

--047d7beba2161d66ce0510eb4145
Content-Type: text/plain; charset=UTF-8

Hi Paul,
thank you for the answer,

2015-03-09 23:34 GMT+01:00 Paul Hoadley <[email protected]>:

> Hi Daniele,
>
> On 10 Mar 2015, at 2:52 am, Daniele Corti <[email protected]> wrote:
>
> No problem in implementation, but, when I create a new object, I've
> noticed that the method didUpdate() is called before didInsert(), so
> creating an entry in DB, perform an Update log and a Insert log. However,
> deleting the Record does not call the didUpdate method, just the didDelete.
>
> It is supposed to do this?
>
>
> That's certainly what it _does_, yes.  So you're not going crazy, and
> nothing is broken.
>

at least this....


>
> The didUpdate documentation say:
>
> Called on the object after is has successfully been updated in the
> database. But the Object is Inserted not Updated, so I don't understand
> very well the working of this...
>
>
> I agree that the documentation is poor.  You might argue that the database
> itself has been "updated" after the insertion, but I think that would be
> confusingly loose language given that there exists an UPDATE SQL statement,
> and it hasn't been used in the case of inserting a new object.
>
>
Ok, so the transaction lifecycle call:

INSERT:

   - willInsert
   - Insert Statement
   - didUpdate
   - didInsert


UPDATE:

   - willUpdate
   - Update Statement
   - didUpdate


DELETE:

   - willDelete
   - Delete Statement
   - didDelete

But, why didUpdate is not called after deletion? The delete is a change in
DB, so is some sort of update....


> Anyway, if this is the normal behavior in EOGenericRecord lifecycle, is
> there a way to notice that the didUpdate method is called on a inserted
> object, or another method must be used in order to do this?
>
>
> willUpdate() is called prior to an actual UPDATE (and not prior to an
> INSERT).  Would this help?
>
>
This could be useful, but, I would like to do the Log when I'm sure the
changes in DB are performed, and willUpdate is called prior of
validateForSave. Is there any problem, if I call the validate method in
willUpdate()?


>
> --
> Paul Hoadley
> http://logicsquad.net/
>
>
>


-- 
Daniele Corti
--
I DON'T DoubleClick

--047d7beba2161d66ce0510eb4145
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Paul,<div>thank you for the answer,=C2=A0</div><div cla=
ss=3D"gmail_extra"><br><div class=3D"gmail_quote">2015-03-09 23:34 GMT+01:0=
0 Paul Hoadley <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]=
" target=3D"_blank">[email protected]</a>&gt;</span>:<br><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;=
border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex=
"><div style=3D"word-wrap:break-word">Hi Daniele,<div><br><div><span class=
=3D""><div>On 10 Mar 2015, at 2:52 am, Daniele Corti &lt;<a href=3D"mailto:=
[email protected]" target=3D"_blank">[email protected]</a>&gt; wrote:</div>=
<br><blockquote type=3D"cite"><div dir=3D"ltr"><div>No problem in implement=
ation, but, when I create a new object, I&#39;ve noticed that the method di=
dUpdate() is called before didInsert(), so creating an entry in DB, perform=
 an Update log and a Insert log. However, deleting the Record does not call=
 the didUpdate method, just the didDelete.</div><div><br></div><div>It is s=
upposed to do this?</div></div></blockquote><div><br></div></span><div>That=
&#39;s certainly what it _does_, yes.=C2=A0 So you&#39;re not going crazy, =
and nothing is broken.</div></div></div></div></blockquote><div><br></div><=
div>at least this....</div><div>=C2=A0<br></div><blockquote class=3D"gmail_=
quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-=
color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style=
=3D"word-wrap:break-word"><div><div><span class=3D""><div><br></div><blockq=
uote type=3D"cite"><div dir=3D"ltr"><div> The didUpdate documentation say:<=
/div><div><p><span>Called on the object after is has successfully been upda=
ted in the database. But the Object is Inserted not Updated, so I don&#39;t=
 understand very well the working of this...</span></p></div></div></blockq=
uote><div><br></div></span><div>I agree that the documentation is poor.=C2=
=A0 You might argue that the database itself has been &quot;updated&quot; a=
fter the insertion, but I think that would be confusingly loose language gi=
ven that there exists an UPDATE SQL statement, and it hasn&#39;t been used =
in the case of inserting a new object.</div><span class=3D""><div><br></div=
></span></div></div></div></blockquote><div><br></div><div>Ok, so the trans=
action lifecycle call:</div><div><br></div><div>INSERT:</div><div><ul><li>w=
illInsert<br></li><li>Insert Statement<br></li><li>didUpdate<br></li><li>di=
dInsert<br></li></ul></div><div><br></div><div>UPDATE:=C2=A0</div><div><ul>=
<li>willUpdate<br></li><li>Update Statement<br></li><li>didUpdate<br></li><=
/ul></div><div><br></div><div>DELETE:</div><div><ul><li>willDelete<br></li>=
<li>Delete Statement<br></li><li>didDelete<br></li></ul></div><div>But, why=
 didUpdate is not called after deletion? The delete is a change in DB, so i=
s some sort of update....</div><div>=C2=A0</div><blockquote class=3D"gmail_=
quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-=
color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style=
=3D"word-wrap:break-word"><div><div><span class=3D""><div></div><blockquote=
 type=3D"cite"><div dir=3D"ltr"><div><p>Anyway, if this is the normal behav=
ior in EOGenericRecord lifecycle, is there a way to notice that the didUpda=
te method is called on a inserted object, or another method must be used in=
 order to do this?</p></div></div></blockquote><div><br></div></span><div>w=
illUpdate() is called prior to an actual UPDATE (and not prior to an INSERT=
).=C2=A0 Would this help?</div><span class=3D""><font color=3D"#888888"><di=
v><br></div></font></span></div></div></div></blockquote><div><br></div><di=
v>This could be useful, but, I would like to do the Log when I&#39;m sure t=
he changes in DB are performed, and willUpdate is called prior of validateF=
orSave. Is there any problem, if I call the validate method in willUpdate()=
?</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0=
px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);b=
order-left-style:solid;padding-left:1ex"><div style=3D"word-wrap:break-word=
"><div><div><span class=3D""><font color=3D"#888888"><div></div><div><br></=
div></font></span></div><span class=3D""><font color=3D"#888888"><div>
<span style=3D"border-collapse:separate;border-spacing:0px"><span style=3D"=
border-collapse:separate;color:rgb(0,0,0);font-family:&#39;Lucida Grande&#3=
9;;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:=
normal;line-height:normal;text-indent:0px;text-transform:none;white-space:n=
ormal;word-spacing:0px"><div style=3D"word-wrap:break-word"><span style=3D"=
border-collapse:separate;color:rgb(0,0,0);font-family:&#39;Lucida Grande&#3=
9;;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:=
normal;line-height:normal;text-indent:0px;text-transform:none;white-space:n=
ormal;word-spacing:0px"><div style=3D"word-wrap:break-word">--=C2=A0<br>Pau=
l Hoadley<br><a href=3D"http://logicsquad.net/" target=3D"_blank">http://lo=
gicsquad.net/</a><br><br></div></span></div></span></span>
</div>
<br></font></span></div></div></blockquote></div><br><br clear=3D"all"><div=
><br></div>-- <br><div class=3D"gmail_signature">Daniele Corti<br>--<br>I D=
ON&#39;T DoubleClick<br></div>
</div></div>

--047d7beba2161d66ce0510eb4145--


--===============6607654649593679539==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
--===============6607654649593679539==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Wonder-disc mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wonder-disc

--===============6607654649593679539==--