Hibernate Error from WriteToDB Smart Service in a process even though new row is successfully inserted to the underlying Oracle Table when a service account ( non default schema) is used for DB access

Issue

 

Hibernate Error from WriteToDB Smart Service in a process even though new row is successfully inserted to the underlying Oracle Table. There is no underlying oracle error.

Error  - ( I have renamed CDT & Datstore & JavaClass Names  )

 

An error occurred while trying to write to the entity "PARENTCDT" [id=5933241b-7d12-4cd4-a2e3-6854e5d4b895@2558, type=PARENTCDT(id=4480)] (data store: DATASOURCENAME). Details: org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): ParentClassNameDT8243 Data: TypedValue[it=4480,v={<null>,,,,,,<null>,<null>,<null>,<null>,,,,,,,<null>,<null>,<null>,,,,1,<null>,,<null>,,,,,<null>,,<null>,<null>,<null>,<null>,,<null>,<null>,<null>,,<null>,<null>,<null>,,<null>,<null>,<null>,}]

Details

 

This error started appearing in our PRE environment where for the first time we use service account user ( non default schema)  to access the default DB schema. The code works fine in other environments where Appian is connected directly to default schema.

 

I have created public synonyms for all the tables and sequences in the default schema so that  service account user/schema (non default DB schema ) can access them. Probably , hibernate has some problem in seeing the sequences . Or this is case of hibernate inconsistency due to nested CDTs. This is just my thoughts on the issue, in case it is helpful.

CDT Annotations

Parent CDT 

Primary key -    @Id

Relationship to Child CDT - @OneToOne(cascade=CascadeType.ALL)

Child CDT

Primary key - @Id

 

Oracle Version

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0

 

Appian Cloud Instance Version

21.2

  Discussion posts and replies are publicly visible

Parents
  • The error you're seeing typically means that you need to define your primary key as an auto-generated value: "ids for this class must be manually assigned before calling save". However it can also occur if you are saving null values into nested CDTs.

    Can you check to see if the CDT has the option selected to auto-generate IDs (and also if the database has the same option)? The other thing I notice is that your value to be inserted has a lot of nulls - is it possible that the data you're trying to insert is empty?

Reply
  • The error you're seeing typically means that you need to define your primary key as an auto-generated value: "ids for this class must be manually assigned before calling save". However it can also occur if you are saving null values into nested CDTs.

    Can you check to see if the CDT has the option selected to auto-generate IDs (and also if the database has the same option)? The other thing I notice is that your value to be inserted has a lot of nulls - is it possible that the data you're trying to insert is empty?

Children