Hello,
I get “violates uniqueness constraint for index Name: (Order Details) PrimaryKey” error when I try to update a row in a table. Although I wanted to update a column that is not a part of primary key …
I tested standard \"Northwind\" database.
Here is a test:
Database db = Database.open(new File(\"c:/java/test/files/northwind/nw2000.mdb\")); Table t = db.getTable(\"Order details\"); Map rowMap = t.getNextRow(); Object[] oldRow = new Object[t.getColumns().size()]; for (int i = 0; i < t.getColumns().size(); i++) { Column mdbColumn = t.getColumns().get(i); oldRow[i] = rowMap.get(mdbColumn.getName()); } // old row [10248, 11, 14.0000, 12, 0.0] // update \"Quantity\" column that is not a part of a primary key column // new row [10248, 11, 14.0000, 15, 0.0] Object[] newRow = oldRow; newRow[3] = new Short((short) 15); t.updateCurrentRow(newRow); // -> exception db.close();
MDB is also attached (I deleted all reports to decrease the file size)
thanks. i can recreate the exception. i'll look into when i get a chance.
okay, i have a handle on the problem at this point. jackcess is not correctly matching up the index information (the wrong index is marked as "primary key").
fixed in the trunk, will be in the 1.2.3 release.