On 5-Jan-08, at 9:30 PM, Don Lindsay wrote:

Hello;

When I insert a new record in an entity, it does not show in other screens right away. I would expect this is due to a commit to the database not being done when the item is inserted. I have looked at the EditingContext object and did not see an explicit commit method. Utilizing refreshallobjects() in an editngcontext also does not show the inserted row. Querying the database directly shows the inserted rows. Is there something I am missing?


Hmm, your terminology is a little confusing Don, in WebObjects we don't "insert records in entities" or "commit", also "show in other screens right away" doesn't really tell me a lot.

In WebObjects the creation of a new EO is as follows:

1. Create the EO and immediately insert it into an EOEditingContext (EC). 2. Optionally repeat step #1 as many times as necessary to create the object graph that fulfills the current business requirement 3. Make changes to the EO(s) to get them into a valid state (set values, build relationships, etc) 4. When happy with the state of all of the EOs in the EC, call ec.saveChanges();
5. Repeat

I'm inferring/guessing that you are running multiple instances of your application, you are creating and inserting an EO into an EOEditingContext and calling ec.saveChanges() from one instance of your app, and then looking at the data from another instance of the app and not seeing the new EO.

If this is the case please read the documentation about data freshness:

<http://developer.apple.com/documentation/WebObjects/Enterprise_Objects/Fetching/chapter_6_section_7.html > <http://wiki.objectstyle.org/confluence/display/WO/EOF-Using+EOF-Caching+and+Freshness >

If this is not the case (ie: you are not running multiple app instances), something is horribly horribly wrong. Tie your code's arms behind its back and throw it into a pool of water, if it doesn't drown, then it's a witch.

;david

--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site:   http://codeferous.com
blog: http://davidleber.net
profile: http://www.linkedin.com/in/davidleber
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to