• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Primary key error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Primary key error


  • Subject: Primary key error
  • From: Stavros Panidis <email@hidden>
  • Date: Mon, 01 Aug 2011 20:10:30 +0300

Hello,

I have the following very strange (for me) problem.

I have a very simple component and a straight forward save method, like  

theTrial = new Trials();
ec.insertObject(theTrial);

… set some values in to the new record ...


ec.saveChanges();

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




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: SQL generation problem with Entity Modeler
  • Next by Date: [Job Posting] Senior WebObjects Engineer - SmartPractice, Inc (Phoenix, AZ)
  • Previous by thread: [workaround]: Re: SQL generation problem with Entity Modeler
  • Next by thread: [Job Posting] Senior WebObjects Engineer - SmartPractice, Inc (Phoenix, AZ)
  • Index(es):
    • Date
    • Thread