• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
EOFCommandments
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EOFCommandments


  • Subject: EOFCommandments
  • From: Wolfram Stebel <email@hidden>
  • Date: Wed, 31 Aug 2005 10:07:44 +0200

Am 29.08.2005 18:53 Uhr schrieb "Chuck Hill" unter
<email@hidden>:

Hi List,

>From another thread:
> Two explanations come to mind:
> 1. You are saving the wrong editing context
> 2. Your bad code has hosed EOF.  Does anything here look familiar?
> http://www.wodev.spearway.com/cgi-bin/WebObjects/WODev.woa/wa/Main?
> wikiPage=EOFCommandments

There is the EOFCommandment:
2. Don't do anything to an EO before inserting it into an editing context.
Always insert EOs into ECs immediately


On the other hand:

There is a document "WebObjects Naming Conventions and Design Patterns" by
email@hidden
whom i followed in recommendations for object creation:

4
Static ³Constructor² Methods: Each custom class will have a static (factory)
³constructor² method which accepts an EOEditingContext and returns an EO of
its class type. The static ³constructor² will also insert the newly created
EO into the passed in editing context and hook up all its appropriate
relationships. Each class may have multiple static methods which handle
different cases when creating new EOs, but each class will at least have the
equivalent of a default static method which is intuitively named, i.e. a
Customer.java EO will have the following method:

public static Customer newCustomer(EOEditingContext editingContext) {
Customer customer = new Customer();
editingContext.insetObject(customer);
return customer;
}

The job of this method is to create a new EO, insert it in the editing
context and hook up its appropriate relationships. The relationship hookups
may be done in awakeFromInsertion().
Other methods will build on this default method such as:

public static Customer newCustomerWithShoppingCart(
EOEditingContext editingContext, ShoppingCart shoppingCart, Sting
relationshipName) {
Customer customer = Customer.newCustomer(editingContext);
customer.addObjectToBothSidesOfRelationshipWithKey(shoppingCart,
relationshipName);
.
.
.
return customer;
}

Is this a save way to create EO's, especially to second one?

Wolfram


 _______________________________________________
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

  • Follow-Ups:
    • Re: EOFCommandments
      • From: David LeBer <email@hidden>
References: 
 >Re: saving changes (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: How to build EOQualifier which generates "IN" SQL statement
  • Next by Date: Re: WebObjects Worx Podcast published !
  • Previous by thread: Re: saving changes
  • Next by thread: Re: EOFCommandments
  • Index(es):
    • Date
    • Thread