ERXFetchSpecification:
setIncludeEditingContextChanges(boolean includeEditingContextChanges)
When true, objectsWithFetchSpecification will include newly inserted
objects, newly removed objects, and newly updated objects in your fetch results
(@see ERXEOControlUtilities.objectsWithQualifier).
On Mar 12, 2011, at 9:20 PM, Paul D Yu wrote:
> Drew
>
> I think you will need to check the objects in memory as well.
>
> Paul
> On Mar 12, 2011, at 9:14 PM, Drew Thoeni wrote:
>
>> I am writing objects to a database in this fashion:
>>
>> 1) reading a text file with companies in it.
>>
>> 2) fetching a company object based on a unique attribute (domain name) from
>> the text file using "objectWithFetchSpecificationAndBindings"
>>
>> 3) if the object is not found, I'm adding the object using
>> ec.insertObject(tempCompany) and, after creating 1,000 objects, I invoke
>> ec.saveChanges(). I'm doing this after 1,000 objects to reduce database
>> overhead.
>>
>> However, I am getting database errors (unique constraint) because there are
>> duplicate items in the text file and the fetch does not seem to be
>> discovering these items in the 1,000 as yet unwritten objects.
>>
>> I thought a fetch would not only check the database but also check the
>> editing context to see if the item was there and not yet committed.
>>
>> I think I must be handling this incorrectly and there is a pattern that
>> would accomplish my goal, which is to add companies from the text file to
>> the database only if the company is not yet in the database, but also do
>> this efficiently. That is, if I invoke ec.saveChanges() for every record,
>> the duplicates are discovered but the process is much slower.
>>
>> Any suggestions are, of course, greatly appreciated.
>>
>>
>> Drew
>>
>>
>>
>>
>> _______________________________________________
>> 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/pyu%40mac.com
>>
>> This email sent to [email protected]
>
> _______________________________________________
> 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/mschrag%40pobox.com
>
> This email sent to [email protected]
_______________________________________________
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]