RE: Locking in an eoObject.awakeFromInsertion(editingContext)?
RE: Locking in an eoObject.awakeFromInsertion(editingContext)?
- Subject: RE: Locking in an eoObject.awakeFromInsertion(editingContext)?
- From: "Pierre Bernard" <email@hidden>
- Date: Wed, 29 Oct 2003 10:08:42 +0100
- Thread-topic: Locking in an eoObject.awakeFromInsertion(editingContext)?
Hi!
I see no need in locking the EC in awakeFromInsertion. That said, it can do no harm either.
However you should make sure to always unlock your EC in a finally clause to avaoid locking up your application when an exception is thrown:
ec.lock();
try
{
// do some stuff
}
finally
{
ec.unlcok();
}
Pierre
--
Got a hang for movies?
http://homepage.mac.com/I_love_my/movies.html
-----Original Message-----
From: Ricardo Strausz [mailto:email@hidden]
Sent: Wednesday, October 29, 2003 2:51 AM
To: email@hidden
Subject: Locking in an eoObject.awakeFromInsertion(editingContext)?
Hola!
just a simple question (I am not familiar with locking editing
contexts):
while (re)implementing the awakeFromInsertion method of an EO (son of
EOGenericRecord), do I have to lock the editing context which is pased
as an argument?
(I am mixing NSDocument architecture and Cocoa/EOF, so I suppose that,
while each NIB has its own editingContext, there may be more than one
in the application)
That is, is the following code correct?
public void awakeFromInsertion(EOEditingContext eoec) {
setFecha(new NSTimestamp());
setEstado(new Integer(1));
setIva(new Integer(15));
}
Or is better?
public void awakeFromInsertion(EOEditingContext eoec) {
eoec.lock();
setFecha(new NSTimestamp());
setEstado(new Integer(1));
setIva(new Integer(15));
eoec.unlock();
}
Dino
http://homepage.mac.com/strausz
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
**********************************************************************
This email and any files transmitted with it are intended solely for
the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the sender
of this message. (email@hidden)
This email message has been checked for the presence of computer
viruses; however this protection does not ensure this message is
virus free.
Banque centrale du Luxembourg; Tel ++352-4774-1; http://www.bcl.lu
**********************************************************************
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.