Re: Updating EOObjects
Re: Updating EOObjects
- Subject: Re: Updating EOObjects
- From: LD <email@hidden>
- Date: Fri, 19 Aug 2005 11:41:05 +1000
Hi there,
On 19/08/2005, at 11:15 AM, Arturo Pérez wrote:
The other big thing is to follow a style of doing most of your work
in the appendToResponse() and to never mutate any on-page data
through the key values that WOBuilder can see.
I sense that appendToResponse has more important duties at hand...
Using the above then your createAndInsertInstance would be used
like this
public void appendToResponse(....) {
if (aLicense == null) aLicense = ...createAndInsert...;
if (aPrincipal == null) aPrincipal = ...createAndInsert...;
super.appendToResponse(...);
}
I don't think that's very helpful in the OO world. Setters and
getters are the way to go so that if you need to reference the object
elsewhere in your code you don't come unstuck.
i.e.,
public Licence licence() {
if ( _aLicence == null ) {
_aLicence = ( Licence )EOUtilities.createAndInsertInstance
( ec, "Licence" );
}
return aLicence;
}
public void setLicence( Licence aLicence ) {
_aLicence = aLicence;
}
and so on...
with regards,
--
LD
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden