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

Discuss all problems you have with Servoy here. It might help to mention the Servoy version and Operating System version you are using

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

Postby deezzub » Thu Aug 15, 2013 3:04 pm

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

Code: Select all
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.

2013-08-15 14_37_45-no_primary_key_error.png
table does not have a primary key error
2013-08-15 14_37_45-no_primary_key_error.png (33.85 KiB) Viewed 7083 times
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany

Re: Error says table has no primary key, but primary key exi

Postby sbutler » Fri Aug 16, 2013 5:07 pm

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.
Scott Butler
iTech Professionals, Inc.
SAN Partner

Servoy Consulting & Development
Servoy University- Training Videos
Servoy Components- Plugins, Beans, and Web Components
Servoy Guy- Tips & Resources
ServoyForge- Open Source Components
User avatar
sbutler
Servoy Expert
 
Posts: 759
Joined: Sun Jan 08, 2006 7:15 am
Location: Cincinnati, OH

Re: Error says table has no primary key, but primary key exi

Postby deezzub » Thu Aug 22, 2013 10:59 am

goldcougar wrote: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.
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany

Re: Error says table has no primary key, but primary key exi

Postby deezzub » Mon Aug 26, 2013 5:38 pm

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

2013-08-26 17_27_02-Servoy_Developer_valuelist_error.png
servoy valuelist column exists error
2013-08-26 17_27_02-Servoy_Developer_valuelist_error.png (31.01 KiB) Viewed 6946 times
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany

Re: Error says table has no primary key, but primary key exi

Postby kwpsd » Mon Aug 26, 2013 10:58 pm

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.
Kim W. Premuda
San Diego, CA USA
User avatar
kwpsd
 
Posts: 687
Joined: Sat Jul 28, 2007 6:59 pm
Location: San Diego, CA USA

Re: Error says table has no primary key, but primary key exi

Postby deezzub » Wed Aug 28, 2013 4:02 pm

kwpsd wrote: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.:

Code: Select all
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)


2013-08-28 15_55_04-Fehler_beim_Speichern.png
error on saving
2013-08-28 15_55_04-Fehler_beim_Speichern.png (72.75 KiB) Viewed 6893 times
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany

Re: Error says table has no primary key, but primary key exi

Postby kwpsd » Thu Aug 29, 2013 7:48 pm

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.
Kim W. Premuda
San Diego, CA USA
User avatar
kwpsd
 
Posts: 687
Joined: Sat Jul 28, 2007 6:59 pm
Location: San Diego, CA USA

Re: Error says table has no primary key, but primary key exi

Postby deezzub » Tue Oct 08, 2013 3:58 pm

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?
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany

Re: Error says table has no primary key, but primary key exi

Postby deezzub » Fri Oct 11, 2013 1:00 pm

Last edited by deezzub on Fri Oct 11, 2013 2:34 pm, edited 1 time in total.
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany

Re: Error says table has no primary key, but primary key exi

Postby ROCLASI » Fri Oct 11, 2013 1:06 pm

deezzub wrote: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.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Error says table has no primary key, but primary key exi

Postby deezzub » Fri Oct 11, 2013 2:34 pm

ROCLASI wrote:
deezzub wrote: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. ;)
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany


Return to Discuss possible Issues and Bugs

Who is online

Users browsing this forum: g.collette and 9 guests