Error says table has no primary key, but primary key exists

After update to Servoy Developer 7.2 on Windows 7 64 bit, I get error messages like the following:

Relation "mitarbeiter_to_mitarbeiterkfz" is referring to a foreign table "mitarbeiterkfz" on server "boss_db" but the foreign table does not have a primary key.

but the table has a primary key. For example If I change the id Row Ident to nothing and save and then back to row_ident and save the error message is gone. After I have closed Servoy Developer and open it again I often get error messages like this, but based on other tables.

[attachment=0]2013-08-15 14_37_45-no_primary_key_error.png[/attachment]

it may be a bug, but the larger question is why doesn’t your table have Primary Keys? using row_ident should only be used if your connecting to a database that doesn’t have the concept of a PK (like FileMaker). Otherwise your db should declare the PK, and Servoy will recognize it.

goldcougar:
it may be a bug, but the larger question is why doesn’t your table have Primary Keys? using row_ident should only be used if your connecting to a database that doesn’t have the concept of a PK (like FileMaker). Otherwise your db should declare the PK, and Servoy will recognize it.

There are FoxPro / dBase tables.

Also I get the following error, which solved like the error above.

[attachment=0]2013-08-26 17_27_02-Servoy_Developer_valuelist_error.png[/attachment]

For Servoy to connect to VFP .DBF tables, the .DBF tables themselves must contain a PK column:

  1. USE tablename
  2. COPY TO tablename_temp
  3. MODI STRU
  4. Column name: PK, Type: Autoinc(Integer)
  5. Save changes
  6. ZAP
  7. APPEND FROM tablename_temp
  8. USE
  9. BROW (optional - to view PKs)
  10. USE
    When connecting to the VFP table from Servoy, make Row Ident ‘row_ident’ for the VFP PK column. That should fix things for you.

kwpsd:
For Servoy to connect to VFP .DBF tables, the .DBF tables themselves must contain a PK column:

  1. USE tablename
  2. COPY TO tablename_temp
  3. MODI STRU
  4. Column name: PK, Type: Autoinc(Integer)
  5. Save changes
  6. ZAP
  7. APPEND FROM tablename_temp
  8. USE
  9. BROW (optional - to view PKs)
  10. USE
    When connecting to the VFP table from Servoy, make Row Ident ‘row_ident’ for the VFP PK column. That should fix things for you.

After your suggestion, I get the following error on saving.:

save failed for 1 or more records
 > com.servoy.j2db.dataprocessing.DataException: java.lang.ClassCastException: com.hxtt.sql.common.c cannot be cast to [I
	at com.hxtt.sql.dbf.j.a(Unknown Source)
	at com.hxtt.sql.c9.do(Unknown Source)
	at com.hxtt.sql.fg.int(Unknown Source)
	at com.hxtt.sql.d2.a(Unknown Source)
	at com.hxtt.sql.bz.a(Unknown Source)
	at com.hxtt.sql.bz.a(Unknown Source)
	at com.hxtt.sql.bz.a(Unknown Source)
	at com.hxtt.sql.am.a(Unknown Source)
	at com.hxtt.sql.d4.executeUpdate(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.servoy.j2db.datasource.Zg.invoke(Zg.java:2)
	at com.sun.proxy.$Proxy22.executeUpdate(Unknown Source)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
	at com.servoy.j2db.dataprocessing.Zv.Za(Zv.java:523)
	at com.servoy.j2db.dataprocessing.Zv.performUpdates(Zv.java:591)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.servoy.j2db.util.AbstractRemoteInvocationHandler.invokeMethod(AbstractRemoteInvocationHandler.java:77)
	at com.servoy.j2db.util.ThreadingRemoteInvocationHandler$1.run(ThreadingRemoteInvocationHandler.java:79)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

	at H:\servoy7_workspace\svy_nav_navigation\openEdits.js:38 (saveEditsFromObject)
	at H:\servoy7_workspace\svy_nav_navigation\forms\svy_nav_base.js:1423 (dc_save)
	at H:\servoy7_workspace\BOSS_Chartering\forms\boss_char_charterfaktura_base_dtl.js:1522 (dc_save)
	at H:\servoy7_workspace\svy_nav_navigation\forms\svy_nav_fr_toolbar_base.js:361 (callProgramFunction)

save failed for 1 or more records
 > com.servoy.j2db.persistence.RepositoryException: java.sql.SQLException: must rollback must rollback
	at H:\servoy7_workspace\svy_nav_navigation\openEdits.js:38 (saveEditsFromObject)
	at H:\servoy7_workspace\svy_nav_navigation\forms\svy_nav_base.js:1423 (dc_save)
	at H:\servoy7_workspace\BOSS_Chartering\forms\boss_char_charterfaktura_base_dtl.js:1522 (dc_save)
	at H:\servoy7_workspace\svy_nav_navigation\forms\svy_nav_fr_toolbar_base.js:361 (callProgramFunction)

com.servoy.j2db.dataprocessing.DataException: java.lang.ClassCastException: com.hxtt.sql.common.c cannot be cast to [I
	at com.hxtt.sql.dbf.j.a(Unknown Source)
	at com.hxtt.sql.c9.do(Unknown Source)
	at com.hxtt.sql.fg.int(Unknown Source)
	at com.hxtt.sql.d2.a(Unknown Source)
	at com.hxtt.sql.bz.a(Unknown Source)
	at com.hxtt.sql.bz.a(Unknown Source)
	at com.hxtt.sql.bz.a(Unknown Source)
	at com.hxtt.sql.am.a(Unknown Source)
	at com.hxtt.sql.d4.executeUpdate(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.servoy.j2db.datasource.Zg.invoke(Zg.java:2)
	at com.sun.proxy.$Proxy22.executeUpdate(Unknown Source)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
	at com.servoy.j2db.dataprocessing.Zv.Za(Zv.java:523)
	at com.servoy.j2db.dataprocessing.Zv.performUpdates(Zv.java:591)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.servoy.j2db.util.AbstractRemoteInvocationHandler.invokeMethod(AbstractRemoteInvocationHandler.java:77)
	at com.servoy.j2db.util.ThreadingRemoteInvocationHandler$1.run(ThreadingRemoteInvocationHandler.java:79)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

	at com.servoy.j2db.dblayer.Zb.Za(Zb.java:194)
	at com.servoy.j2db.server.Za.Zo.Za(Zo.java:1521)
	at com.servoy.j2db.dataprocessing.Zv.Za(Zv.java:1199)
	at com.servoy.j2db.dataprocessing.Zv.performUpdates(Zv.java:591)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.servoy.j2db.util.AbstractRemoteInvocationHandler.invokeMethod(AbstractRemoteInvocationHandler.java:77)
	at com.servoy.j2db.util.ThreadingRemoteInvocationHandler$1.run(ThreadingRemoteInvocationHandler.java:79)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

com.servoy.j2db.persistence.RepositoryException: java.sql.SQLException: must rollback must rollback
	at com.servoy.j2db.dataprocessing.Zv.Za(Zv.java:55)
	at com.servoy.j2db.dataprocessing.Zv.performUpdates(Zv.java:591)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.servoy.j2db.util.AbstractRemoteInvocationHandler.invokeMethod(AbstractRemoteInvocationHandler.java:77)
	at com.servoy.j2db.util.ThreadingRemoteInvocationHandler$1.run(ThreadingRemoteInvocationHandler.java:79)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

[attachment=0]2013-08-28 15_55_04-Fehler_beim_Speichern.png[/attachment]

Well, it looks like you got past the PK issue! :wink:

com.servoy.j2db.dataprocessing.DataException: java.lang.ClassCastException: com.hxtt.sql.common.c cannot be cast to [I

It appears that the error message was truncated, so it is difficult to know exactly why the HXTT driver is complaining. However, I suspect that you are supplying a value that the HXTT driver is attempting to convert to an Integer (the truncated ‘I’ in the error message) in order to match the table column type. Recheck the supplied value types against the table column types.

Today I got a message, see subject, but for a SQL table which has a “Row Ident” pk for the “servoy_se” column. So I changed another columns “Row Ident” to row_ident and saved the change. After that I reverted the columns “Row Ident” to nothing like before and saved. Now the error messages are gone.

So this error is maybe not related to any special database?

Bug: SVY-5217.

deezzub:
Bug: SVY-5217 is fixed in Servoy 7.4

Actually how this works is that the fix version is the planned version to fix it in.
It is not certain until the issue is actually closed/fixed. SVY-5217 is still unresolved at this time.

Hope this explains things better.

ROCLASI:

deezzub:
Bug: SVY-5217 is fixed in Servoy 7.4

Actually how this works is that the fix version is the planned version to fix it in.
It is not certain until the issue is actually closed/fixed. SVY-5217 is still unresolved at this time.

Hope this explains things better.

Sorry, you are right. I have read inaccurately. I change it. ;)