CDT Write to Data Store error: primary key "doesn't have a default value"

I created a CDT mapped to a data store entity with an auto-generated primary key (field name = "id").  I have a process that inserts one new instance of the CDT each time it runs.  The first two executions created two entries in the data store as expected.  The third and subsequent tries failed to insert, and produced this error message:

Details:  An error occurred while trying to write to the entity “CB_PWDBW” [id=b20cef01-aa95-4382-84eb-14de73b1a967@4057, type=CB_PWDBW (id=2778)] (data store: CB Data Store). Details: org.hibernate.exception.GenericJDBCException: could not insert: [CBPWDBWDT1716]: java.sql.SQLException: Field 'id' doesn't have a default value Data: TypedValue[it=2778,v={Bainwright Corporation,9998887776665,1,1,0,0,1,{,Chicago,IL,,USA,},<null>}]

I'm puzzled by this error, as the field"id" is defined as a primary key, with the auto-generate option checked:

Any help would be appreciated.

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    Hi  may I know, which database you are working with. If you are working with Oracle, then you shouldn't use id and name as a column name, because these are the reserved keywords of Oracle. But if you are working with MySQL then I believe, Cross check the following use cases as mention below:

    Case 1: Check the table structure in DB explicitly and make sure Id is configured as AUTO_INCREMENT because your mapping can be successful in Appian even when AUTO_INCREMENT configuration do not match.

    Case 2: create a duplicate CDT and modify the xsd (entity name, column name etc) and persist the data on this entity.

    As per my understanding, Case 1 might be useful.

Reply
  • +1
    Certified Lead Developer

    Hi  may I know, which database you are working with. If you are working with Oracle, then you shouldn't use id and name as a column name, because these are the reserved keywords of Oracle. But if you are working with MySQL then I believe, Cross check the following use cases as mention below:

    Case 1: Check the table structure in DB explicitly and make sure Id is configured as AUTO_INCREMENT because your mapping can be successful in Appian even when AUTO_INCREMENT configuration do not match.

    Case 2: create a duplicate CDT and modify the xsd (entity name, column name etc) and persist the data on this entity.

    As per my understanding, Case 1 might be useful.

Children