• 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: fetchAllEntities() only returns saved eo?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fetchAllEntities() only returns saved eo?


  • Subject: Re: fetchAllEntities() only returns saved eo?
  • From: Andrew Lindesay <email@hidden>
  • Date: Sun, 2 Aug 2009 22:56:47 +1200

Hello Yung-Luen;

A "fetch" using EOFetchSpecification will retrieve fresh data from the database.

If you have an editing context where changes have been made in-memory but not persisted to the database, those changes are not visible to other editing contexts.

An approach you may like to think about is to add an attribute such as "isVisibleFlag" to your entity. This attribute would have a value of 0 (false) or 1 (true). You could avoid data being shown to customers when the flag is set to false. This will require you to use a qualified EOFetchSpecification to obtain your product list rather than an unqualified fetch.

Regards;

On 2/08/2009, at 10:12 PM, Yung-Luen Lan wrote:

Hi,

I'm implementing a back-end of a e-commerce system, which do CRUD on product records.

To return a list of products, I wrote:

        return Product.fetchAllProducts(ec);

To add a new product, I wrote:

Product p = new Product();
ec.insertObject(p); // the same ec as in Product.fetchAllProducts(ec)
p.setTitle("New Item");
return null;


Since I don't want the newly created product object be exposed to customer––especially when the price value is default value zero, I don't save the ec immediately. Instead, I have a save and cancel button to commit the product information.

However, when I add a new product, it's not shown in Product.fetchAllProducts(ec). How can I get all the product objects in an ec nevertheless it has been saved or not? Thanks.

Regards,
yllan
_______________________________________________
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

___ Andrew Lindesay www.lindesay.co.nz

_______________________________________________
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


References: 
 >fetchAllEntities() only returns saved eo? (From: Yung-Luen Lan <email@hidden>)

  • Prev by Date: Re: CalDAV and WebCalendars
  • Next by Date: Deployment with Embedded Frameworks and Duplicate libraries
  • Previous by thread: fetchAllEntities() only returns saved eo?
  • Next by thread: Re: CalDAV and WebCalendars
  • Index(es):
    • Date
    • Thread