I have the following very strange (for me) problem.
… set some values in to the new record ...
When there are no records in to the table, first record is always saved correctly and PK takes the value of 1; After that, when I try to create and save a new record I always take the following error
IllegalArgumentException: Array is empty
at com.webobjects.foundation.NSArray.objectAtIndex(NSArray.java:377)
at com.webobjects.jdbcadaptor.JDBCPlugIn.newPrimaryKeys(JDBCPlugIn.java:777)
... skipped 3 stack elements
at com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingContext(EOObjectStoreCoordinator.java:370)
at com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3192)
at er.extensions.eof.ERXEC._saveChanges(ERXEC.java:1085)
at er.extensions.eof.ERXEC.saveChanges(ERXEC.java:1007)
at webcore.app.components.ConfigurationComponent.saveTrial(ConfigurationComponent.java:714)
... skipped 44 stack elements
The strange thing is that when I delete EO_PK_TABLE corresponding record, either manually or from inside code like
String pkString = new String ("delete from EO_PK_TABLE where NAME = 'Trials'");
NSArray deletePK = EOUtilities.rawRowsForSQL(ec, "MyModel", pkString, null);
and try to save, new records are saved normally, without any problem and PK is increasing accordingly.
Also, certainly I have no problem saving records to other tables of database from inside the same component. Also I can not realize any other problem running my application.
I would appreciated to have some help on this if possible.
Many thanks in advance
Stavros Panidis
PS
Development environment
Mac OS X 10.7
MySQL 5.5.13
JDBC connector 5.1.17