• 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
Re: Duplicate record
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Duplicate record


  • Subject: Re: Duplicate record
  • From: Art Isbell <email@hidden>
  • Date: Wed, 21 Jul 2004 10:56:40 -1000

On Jul 21, 2004, at 10:12 AM, A. Uchida wrote:

DetailViewPage (showing details of a product record)
    protected Product aProduct = new Product();

A new empty Product is created when a new DetailViewPage is instantiated.


public productInputPage actEditProduct() {
productInputPage nextPage = (productInputPage)pageWithName("productInputPage");
EOEditingContext ec = session().defaultEditingContext();
ec.insertObject((Product)aNewProduct);

aNewProduct is inserted into an editing context. But what is aNewProduct? Does aNewProduct.createdDate() return null?


setANewProduct(aProduct);

This assigns the new empty Product, aProduct, to aNewProduct.

nextPage.setAProduct(aNewProduct);

This passes aProduct to "productInputPage".

        return nextPage;
    }
    public void setANewProduct(Product newProduct) {
        aNewProduct = newProduct;
    }

productInputPage (text boxes for new/editing record)
protected Product aProduct; (new instance to display/Edit binded to text boxes)
Method
public productListPage actSaveNewProduct() {
productListPage nextPage = (productListPage)pageWithName("productListPage");
aProduct.setCreatedDate(new NSTimestamp());

This sets createdDate on the original aProduct from the previous page.

session().defaultEditingContext().saveChanges();

This will save all changes including those to aNewProduct which was inserted on the previous page.


        return nextPage;
    }
    public void setAProduct(Product newAProduct) {
        aProduct = newAProduct;
    }

But the above codes gets the error of "CreatedDate not allowed to be null"

Could aNewProduct.createdDate() be null?

Aloha,
Art
_______________________________________________
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.


References: 
 >Duplicate record (From: "A. Uchida" <email@hidden>)
 >Re: Duplicate record (From: Hunter Hillegas <email@hidden>)
 >Re: Duplicate record (From: "A. Uchida" <email@hidden>)
 >Re: Duplicate record (From: Hunter Hillegas <email@hidden>)
 >Re: Duplicate record (From: "A. Uchida" <email@hidden>)
 >Re: Duplicate record (From: Hunter Hillegas <email@hidden>)
 >Re: Duplicate record (From: "A. Uchida" <email@hidden>)

  • Prev by Date: Re: Duplicate record
  • Next by Date: simple question?
  • Previous by thread: Re: Duplicate record
  • Next by thread: Re: Duplicate record
  • Index(es):
    • Date
    • Thread