Hi all,

Using WO 5.3 with mySQL, I have an entity that has a primary key (int) and when I save a record in the database, another attribute (of type String) gets assigned the value of the primary key also.

To do this, I have to first save the record in the database in order for the primary key to be generated. Then I assign the primary key value to the other attribute and resave the record.

Something like this:


ec.saveChanges(); >-- saves the record to the database, assigns the primary key
myEOObject.setAccountNumber(myEOObject.pkID().toString());
ec.saveChanges();

Obviously I am accessing the primary key via an accessor method of my custom class using the EOUtilities framework.

Anyway, the problem is that occasionally (maybe 10% of the time) the row fails to update and generates an exception stating 'failed to update row in database'. Everything is saved fine, the primary key is assigned, but after the second ec.saveChanges() is where it fails.

Does anyone have any idea why that might be? Is it perhaps because it is trying to update the database too quickly after a previous update?

Kind regards,
David.

_______________________________________________
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