<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Sorry for chiming in late - it's been a busy week.<br>
<br>
In general, one of the invariants in Glorp is that you don't want to
mix objects between sessions. The proxies remember what session
they're associated with, and worse, you can end up with duplicate
objects in the session, and it can be really difficult to debug. So
it's definitely something to avoid. If you read an object through a
session, then you want to use it within that same session.<br>
<br>
<blockquote style="border: 0px none;"
cite="mid:BANLkTimTwxqVD3Wwf_5em7Mc2Rs6sZ3zew@mail.gmail.com"
type="cite">
<div style="margin-left: 40px;">
<hr style="border-width: 1px 0pt 0pt; border-style: dotted none
none; border-color: rgb(181, 181, 181) -moz-use-text-color
-moz-use-text-color; height: 1px; margin: 0pt;"
class="__pbConvHr"><br>
</div>
<div style="margin-left: 40px;"><a moz-do-not-send="true"
href="mailto:diogenes.moreira@gmail.com" style="color: rgb(0,
136, 204) ! important; text-decoration: none ! important;">Diogenes
Moreira</a><br>
<font color="#888888">May 24, 2011 5:20 AM</font></div>
<br>
<div style="color: rgb(136, 136, 136); margin-left: 40px;"
__pbrmquotes="true" class="__pbConvBody"><br>
Well, sorry, for the previous mail, because i was answer from my
cel phone..<br>
<br>
The problem is that:<br>
<br>
When you works with a proxy, the proxy collaborators isn`t in
the proxy.. the collaborators are in the ObjectTransatcion.. in
the UnitOfwork in the Session. And the RealObject Structure and
changes is in Mementos dictionary in ObjectTransatcion.<br>
In Addition The Proxies has attached the Session.. <br>
<br>
Yes, you right.. in you previous mail.. <br>
<br>
but for reattaching you need copy the mementos and proxies
collaborators from ObjectTransaction to new Session...<br>
and change the session from all proxies..<br>
<br>
ufff.. too much work.. :) ..<br>
<br>
i don't kwon how much cost for refresh object (with the
unnecessary DB Read), but in the most of case, is cheaper use
the refresh method or maintain live the GlorpSession.<br>
<br>
if you want solve this problem.. be my guest.. but i suggest,
wait for new GlorpDBX version (coming soon) and write first to
Alan Knight in core glorp list.. He can give better support than
me.<br>
<br>
Best<br>
D.<br>
<br>
<br>
<div>_______________________________________________<br>
SqueakDBX mailing list<br>
<a class="moz-txt-link-abbreviated" href="mailto:SqueakDBX@lists.squeakfoundation.org">SqueakDBX@lists.squeakfoundation.org</a><br>
<a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/mailman/listinfo/squeakdbx">http://lists.squeakfoundation.org/mailman/listinfo/squeakdbx</a><br>
</div>
<hr style="border-width: 1px 0pt 0pt; border-style: dotted none
none; border-color: rgb(181, 181, 181) -moz-use-text-color
-moz-use-text-color; height: 1px; margin: 15px 0pt 0pt;"
class="__pbConvHr"><br>
</div>
<div style="margin-left: 40px;"><a moz-do-not-send="true"
href="mailto:diogenes.moreira@gmail.com" style="color: rgb(0,
136, 204) ! important; text-decoration: none ! important;">diogenes.moreira@gmail.com</a><br>
<font color="#888888">May 20, 2011 10:00 AM</font></div>
<br>
<div style="color: rgb(136, 136, 136); margin-left: 40px;"
__pbrmquotes="true" class="__pbConvBody"><br>
<div>You must use GlorpSession>>refresh: anObject to
attach anObject to new Session<br>
<br>
Best.<br>
D<br>
Enviado desde mi BlackBerry® de Claro Argentina<br>
<br>
-----Original Message-----<br>
From: Panu Suominen <a class="moz-txt-link-rfc2396E" href="mailto:panu.j.m.suominen@gmail.com"><panu.j.m.suominen@gmail.com></a><br>
Sender: <a class="moz-txt-link-abbreviated" href="mailto:squeakdbx-bounces@lists.squeakfoundation.org">squeakdbx-bounces@lists.squeakfoundation.org</a><br>
Date: Fri, 20 May 2011 10:51:38 <br>
To: The complete and open-source solution to relational
database access<a class="moz-txt-link-rfc2396E" href="mailto:squeakdbx@lists.squeakfoundation.org"><squeakdbx@lists.squeakfoundation.org></a><br>
Reply-To: <a class="moz-txt-link-abbreviated" href="mailto:panu.suominen@iki.fi">panu.suominen@iki.fi</a>,<br>
The complete and open-source solution to relational database
access<br>
<a class="moz-txt-link-rfc2396E" href="mailto:squeakdbx@lists.squeakfoundation.org"><squeakdbx@lists.squeakfoundation.org></a><br>
Subject: [SqueakDBX] Should "GlorpSession>>register:"
work?<br>
<br>
We have problem with reattaching objects to new session.<br>
<br>
Following code throws exception telling that connection is not
open.<br>
|person|<br>
KLDatabase withSession: [:s|<br>
person := s readOneOf: KLPerson where: [:p| p id = 6127]. <br>
].<br>
<br>
KLDatabase withSession: [:s|<br>
s inUnitOfWorkDo: [<br>
self halt.<br>
s register: person.<br>
Transcript show: person parameters.<br>
]<br>
].<br>
<br>
The problem seems to be that "GlorpSession>>register:"
does not check<br>
if there is an Glorp proxy inside the object being registered.<br>
Tutorial
(<a class="moz-txt-link-freetext" href="http://www.eli.sdsu.edu/SmalltalkDocs/GlorpTutorial.pdf">http://www.eli.sdsu.edu/SmalltalkDocs/GlorpTutorial.pdf</a>)<br>
states that it should reattach any nested objects (proxies)
too but it<br>
does not.<br>
<br>
Is this known problem or am I doing something wrong? I can try
to fix<br>
this if this is an actual bug. Of course using refresh:<br>
one can avoid this problem but it causes unnecessary database
reads to occur.<br>
<br>
<br>
</div>
<div>_______________________________________________<br>
SqueakDBX mailing list<br>
<a class="moz-txt-link-abbreviated" href="mailto:SqueakDBX@lists.squeakfoundation.org">SqueakDBX@lists.squeakfoundation.org</a><br>
<a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/mailman/listinfo/squeakdbx">http://lists.squeakfoundation.org/mailman/listinfo/squeakdbx</a><br>
</div>
<hr style="border-width: 1px 0pt 0pt; border-style: dotted none
none; border-color: rgb(181, 181, 181) -moz-use-text-color
-moz-use-text-color; height: 1px; margin: 15px 0pt 0pt;"
class="__pbConvHr"><br>
</div>
<div style="margin-left: 40px;"><a moz-do-not-send="true"
href="mailto:panu.j.m.suominen@gmail.com" style="color: rgb(0,
136, 204) ! important; text-decoration: none ! important;">Panu
Suominen</a><br>
<font color="#888888">May 20, 2011 3:51 AM</font></div>
<br>
<div style="color: rgb(136, 136, 136); margin-left: 40px;"
__pbrmquotes="true" class="__pbConvBody"><br>
<div>We have problem with reattaching objects to new session.<br>
<br>
Following code throws exception telling that connection is not
open.<br>
|person|<br>
KLDatabase withSession: [:s|<br>
person := s readOneOf: KLPerson where: [:p| p id = 6127]. <br>
].<br>
<br>
KLDatabase withSession: [:s|<br>
s inUnitOfWorkDo: [<br>
self halt.<br>
s register: person.<br>
Transcript show: person parameters.<br>
]<br>
].<br>
<br>
The problem seems to be that "GlorpSession>>register:"
does not check<br>
if there is an Glorp proxy inside the object being registered.<br>
Tutorial
(<a class="moz-txt-link-freetext" href="http://www.eli.sdsu.edu/SmalltalkDocs/GlorpTutorial.pdf">http://www.eli.sdsu.edu/SmalltalkDocs/GlorpTutorial.pdf</a>)<br>
states that it should reattach any nested objects (proxies)
too but it<br>
does not.<br>
<br>
Is this known problem or am I doing something wrong? I can try
to fix<br>
this if this is an actual bug. Of course using refresh:<br>
one can avoid this problem but it causes unnecessary database
reads to occur.<br>
<br>
<br>
</div>
</div>
</blockquote>
</body>
</html>