Re: getting the database values of an object without changing the one in the current editing context

2007-07-05 Thread Guido Neitzer

On 05.07.2007, at 13:46, WO Dev wrote:

Actually I need it to save the previous object as a string (in fact  
an xml representation).
So my process is to manipulate an object, and when I submit the  
changes, just before saveChanges, I'm tracking who did this, when,  
and the xml representation.


That's why I'd like to get the database "state" of the object when  
I do te tracking part.


You can use "snapshot()" to get the state, for which EOF thinks it is  
the current database state. If some other application changed it,  
this might be different from the actual values in the database.


You could also use a raw sql query to get the current content from  
the database.


I use "changesFromSnapshot" to collect only changes to the objects.  
My eo superclass does all that for me and creates a dictionary of  
changes when the object is saved.


cug
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: getting the database values of an object without changing the one in the current editing context

2007-07-05 Thread WO Dev

Hello Ken,



Xavier,

EOF does this exact thing when it's deciding what has changed in  
your object, and what updates it needs to perform.  It does this by  
using the snapshot, which is how I'd recommend you doing this as well.


It would help if you clued us in to *why* you need it - so that  
answers could be crafted to your particular usage.


Actually I need it to save the previous object as a string (in fact  
an xml representation).
So my process is to manipulate an object, and when I submit the  
changes, just before saveChanges, I'm tracking who did this, when,  
and the xml representation.


That's why I'd like to get the database "state" of the object when I  
do te tracking part.


Xavier



Ken

On Jul 5, 2007, at 6:28 AM, WO Dev wrote:


Hi,

I'm not sure my subject is understandable, anyway.
Assuming I have an object "x", I'm manipulating it in an editing  
context. At a certain point I need to get the original object (the  
one from the database) but without changing anything to the one in  
my editing context.


How could I do that?

I need the object in its globality, so if I can get the object  
directly and not a dictionary of its values it's better:)


You can answer "bla bla project wonder":) but please point me to  
the correct method as I didn't find it for now;)


Thanks,

Xavier
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/kenlists% 
40anderhome.com


This email sent to [EMAIL PROTECTED]





 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: getting the database values of an object without changing the one in the current editing context

2007-07-05 Thread Chuck Hill


On Jul 5, 2007, at 3:28 AM, WO Dev wrote:


Hi,

I'm not sure my subject is understandable, anyway.
Assuming I have an object "x", I'm manipulating it in an editing  
context. At a certain point I need to get the original object (the  
one from the database) but without changing anything to the one in  
my editing context.


How could I do that?

I need the object in its globality, so if I can get the object  
directly and not a dictionary of its values it's better:)


You can answer "bla bla project wonder":) but please point me to  
the correct method as I didn't find it for now;)


What, exactly, is it that you need?  You can't have two different  
versions of the same EO in the same EOF stack.  Avoiding that is one  
of the central objectives of EOF.  Do you need it as an object or  
just as a dictionary of values.  If you need it as an EO, you can't  
have it.  If you need just a dictionary of values, then which  
dictionary?  The values the last time that EOF fetched it from the  
database (or successfully saved it to the database):


NSDictionary valuesAsLastFetchedFromTheDatabase = eo.editingContext 
().committedSnapshotForObject(eo);


If you need a dictionary of the current values in the database, use  
EOUtilities.qualifierForEnterpriseObject and a fetch spec set for raw  
rows.


Chuck

--

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.

http://www.global-village.net/products/practical_webobjects





___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: getting the database values of an object without changing the one in the current editing context

2007-07-05 Thread WO Dev

Hello Atze:),

I could do that. Am I going to have issues if I try to create a local  
instance in my "current" editing context?


I'll try that, thanks

Xavier




Xavier,

maybe you should use a second EOEditingContext to fetch that  
„original“?

Or you migrate to a second edcon before you start to modify?

atze


Am 05.07.2007 um 12:28 schrieb WO Dev:


Hi,

I'm not sure my subject is understandable, anyway.
Assuming I have an object "x", I'm manipulating it in an editing  
context. At a certain point I need to get the original object (the  
one from the database) but without changing anything to the one in  
my editing context.


How could I do that?

I need the object in its globality, so if I can get the object  
directly and not a dictionary of its values it's better:)


You can answer "bla bla project wonder":) but please point me to  
the correct method as I didn't find it for now;)


Thanks,

Xavier
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/atze% 
40freeport.de


This email sent to [EMAIL PROTECTED]


Freeport & Soliversum
Alexander Spohr
[EMAIL PROTECTED]
www.freeport.de





___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: getting the database values of an object without changing the one in the current editing context

2007-07-05 Thread WO Dev

Thanks Cyryl,

Well I was hoping not to have to deal with "I have to store the  
object somewhere before even knowing I might need it's previous state  
later";)


Xavier



WO Dev wrote:

Hi,
I'm not sure my subject is understandable, anyway.
Assuming I have an object "x", I'm manipulating it in an editing  
context. At a certain point I need to get the original object (the  
one from the database) but without changing anything to the one in  
my editing context.

How could I do that?
I need the object in its globality, so if I can get the object  
directly and not a dictionary of its values it's better:)
You can answer "bla bla project wonder":) but please point me to  
the correct method as I didn't find it for now;)


one of the possible ways of doing that is to make object.snapshot()  
before changing it and after some time create new editing context ,  
fetch the object into it and then do  
objectInTheNewEditingContext.updateFromSnapshot()


changes would be made to the objectInTheNewEditingContext only

--
Cyryl Plotnicki-Chudyk
Software Developer
Power Media S.A.
http://www.power.com.pl

District Court for Wroclaw-Fabryczna
KRS: 281947
NIP: PL-898-16-47-572
Capital stock: 500 000 PLN




___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: getting the database values of an object without changing the one in the current editing context

2007-07-05 Thread Ken Anderson

Xavier,

EOF does this exact thing when it's deciding what has changed in your  
object, and what updates it needs to perform.  It does this by using  
the snapshot, which is how I'd recommend you doing this as well.


It would help if you clued us in to *why* you need it - so that  
answers could be crafted to your particular usage.


Ken

On Jul 5, 2007, at 6:28 AM, WO Dev wrote:


Hi,

I'm not sure my subject is understandable, anyway.
Assuming I have an object "x", I'm manipulating it in an editing  
context. At a certain point I need to get the original object (the  
one from the database) but without changing anything to the one in  
my editing context.


How could I do that?

I need the object in its globality, so if I can get the object  
directly and not a dictionary of its values it's better:)


You can answer "bla bla project wonder":) but please point me to  
the correct method as I didn't find it for now;)


Thanks,

Xavier
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/kenlists% 
40anderhome.com


This email sent to [EMAIL PROTECTED]


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: getting the database values of an object without changing the one in the current editing context

2007-07-05 Thread Alexander Spohr

Xavier,

maybe you should use a second EOEditingContext to fetch that „original“?
Or you migrate to a second edcon before you start to modify?

atze


Am 05.07.2007 um 12:28 schrieb WO Dev:


Hi,

I'm not sure my subject is understandable, anyway.
Assuming I have an object "x", I'm manipulating it in an editing  
context. At a certain point I need to get the original object (the  
one from the database) but without changing anything to the one in  
my editing context.


How could I do that?

I need the object in its globality, so if I can get the object  
directly and not a dictionary of its values it's better:)


You can answer "bla bla project wonder":) but please point me to  
the correct method as I didn't find it for now;)


Thanks,

Xavier
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/atze% 
40freeport.de


This email sent to [EMAIL PROTECTED]


Freeport & Soliversum
Alexander Spohr
[EMAIL PROTECTED]
www.freeport.de


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: getting the database values of an object without changing the one in the current editing context

2007-07-05 Thread Cyryl Plotnicki-Chudyk

WO Dev wrote:

Hi,

I'm not sure my subject is understandable, anyway.
Assuming I have an object "x", I'm manipulating it in an editing 
context. At a certain point I need to get the original object (the one 
from the database) but without changing anything to the one in my 
editing context.


How could I do that?

I need the object in its globality, so if I can get the object directly 
and not a dictionary of its values it's better:)


You can answer "bla bla project wonder":) but please point me to the 
correct method as I didn't find it for now;)




one of the possible ways of doing that is to make object.snapshot() 
before changing it and after some time create new editing context , 
fetch the object into it and then do 
objectInTheNewEditingContext.updateFromSnapshot()


changes would be made to the objectInTheNewEditingContext only

--
Cyryl Plotnicki-Chudyk
Software Developer
Power Media S.A.
http://www.power.com.pl

District Court for Wroclaw-Fabryczna
KRS: 281947
NIP: PL-898-16-47-572
Capital stock: 500 000 PLN

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


getting the database values of an object without changing the one in the current editing context

2007-07-05 Thread WO Dev

Hi,

I'm not sure my subject is understandable, anyway.
Assuming I have an object "x", I'm manipulating it in an editing  
context. At a certain point I need to get the original object (the  
one from the database) but without changing anything to the one in my  
editing context.


How could I do that?

I need the object in its globality, so if I can get the object  
directly and not a dictionary of its values it's better:)


You can answer "bla bla project wonder":) but please point me to the  
correct method as I didn't find it for now;)


Thanks,

Xavier
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]