How can we help you?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

"com.softwaretree.jx.JXSessionException: Table or view Emp not found" with AUTOINCREMENT column

edited November 2015 in JDXA for Android
One of the reasons you may see this exception "Table or view Emp not found" is as follows:

When you define a mapping for a primary key attribute using the SQLTYPE 'INTEGER PRIMARY KEY AUTOINCREMENT' but forget to add the RDBMS_GENERATED statement for that attribute (as in the example below for the id attribute), JDXA generates an additional PRIMARY KEY clause in the CREATE TABLE statement; SQLite does not like that CREATE TABLE statement and does not create the table leading to the subsequent exception "Table or view Emp not found".

// The following ORM specification does not have an RDBMS_GENERATED statement for the primary key attribute id of the class Employee and that causes the reported problem

CLASS Employee TABLE Emp PRIMARY_KEY id SQLMAP FOR id SQLTYPE 'INTEGER PRIMARY KEY AUTOINCREMENT' ;

If you run JDXA with DEBUG_LEVEL of 3 or less, you can see the erroneous CREATE TABLE statement for the table Emp and the resulting exception in the Logcat.

The fix is to add RDBMS_GENERATED statement for the id attribute as shown below:

CLASS Employee TABLE Emp PRIMARY_KET id SQLMAP FOR id SQLTYPE 'INTEGER PRIMARY KEY AUTOINCREMENT' RDBMS_GENERATED id ;

Comments

Sign In or Register to comment.