On 21/apr/2011, at 10.14, Philippe Rabier wrote:

> EOF can't update a user because it's likely that the same user has been 
> updated by another instance between the moment where the user has been 
> fetched and the moment where is's saved. You should see that if you set 
> EOAdaptorDebugEnabled to true 
> (log4j.logger.er.transaction.adaptor.EOAdaptorDebugEnabled=DEBUG).
> 
> First don't call editingContex.save() at the end of the merge but in your 
> loop, for example every ten users modified. The very crap but quickest way to 
> solve : relaunch your app and merge again (it's very dirty, I know).

+1

you could also try to fix it directly with SQL in database, is a to-one 
relationship so you have just to update the id  ( a search/replace )

update TABLE_NAME set FIELD_NAME = NEW_ID where FIELD_NAME  = OLD_ID;

DO A BACKUP FIRST !
you could also create a new column in the database and copy all relationships 
IDs before touching it, so you have a quick restorable backup (remember to 
allow null values, otherwise you will get in error adding a new row)

Regards
Amedeo

> 
> Better way: use ERXFetchSpecificationBatchIterator. You don't waste memory 
> usage and if the batch size is small, statistically, the problem will raise 
> less often. And you have to deal with this exception, aka invalidate the 
> user. If you have an instance dedicated to the merge, you won't have any 
> issue otherwise it can be tricky if the same object is modified in another 
> editing context, the modifications are lost (read Practical WO again and 
> again).
> 
> The best solution is to avoid the problem during record imports, isn't it?
> 
> Philippe
> 
> 
> On 21 avr. 2011, at 04:39, Ken - Watermark Studios wrote:
> 
>> So, I have over 4000 user objects related to about 20 country objects. I had 
>> a few duplicate countries in the country table because of record imports. 
>> So, I wrote a quick direct action that allows me to merge the countries. 
>> Basically, there are two drop-down lists, each with the full country list 
>> (including duplicates). I can select two different country objects and the 
>> page moves all users of the first selected country to the second selected 
>> country.
>> 
>> Here's the problem. I've been successful merging almost every country to the 
>> appropriate country. The successful merges have had between 1-500 user 
>> objects to move. When I was trying to move USA related users to United 
>> States, 900 records successfully move, but I get the following error for 
>> over 200 records.
>> 
>> "er.transaction.adaptor.Exceptions  - Database Exception occured: 
>> com.webobjects.eoaccess.EOGeneralAdaptorException: 
>> updateValuesInRowDescribedByQualifier -- 
>> com.webobjects.jdbcadaptor.JDBCChannel method failed to update row in 
>> database
>> updateValuesInRowDescribedByQualifier -- 
>> com.webobjects.jdbcadaptor.JDBCChannel method failed to update row in 
>> database"
>> 
>> Where should I start looking to resolve? I've compared the data from objects 
>> that successfully transferred against those that didn't transfer and I'm not 
>> seeing a clear pattern.
>> 
>> Thanks,
>> 
>> Ken
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/prabier%40me.com
>> 
>> This email sent to prab...@me.com
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/amedeomailing%40insigno.it
> 
> This email sent to amedeomail...@insigno.it

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

This email sent to arch...@mail-archive.com

Reply via email to