Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ADF - Need help in inserting data in to a table having a primary key column marked as Identity (orac

User13332910-OracleMar 28 2017 — edited Mar 30 2017

Hello experts.

I am sure this might have been solved but unable to find a solution as all available documents are referring to sequence numbers and DB triggers.

I have the following table created in Oracle 12c:

  CREATE TABLE "SYSTEM"."SYNC_META_DEFN"

   (    "SYNC_ID" NUMBER GENERATED ALWAYS AS IDENTITY MINVALUE 1 MAXVALUE 99999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE  NOT NULL ENABLE,

   "SYNC_STATUS" VARCHAR2(20 BYTE),

        CONSTRAINT "SYNC_META_DEFN_PK" PRIMARY KEY ("SYNC_ID")

**Snip****

I created a Entity and view from this table and the SYNC_ID is now marked as BigDecimal.

Now I do the following:

1. Rest request - POST: without specifying the SYNC_ID (as it will be auto generated by DB) and get a validation error

     Exception in thread "main" oracle.jbo.AttrValException: JBO-27014: Attribute SyncID in syncMetaDefn is required.

Question: I am sure I am missing something here and any pointers? What needs to be done so that the jbo skips the validation for the identity column (i feel it feels that SyncID is mandatory as it is a primary key)

2. Added a dummy value to the SYNC_ID in the rest request and now it passes validation but throws SQL error

     Exception in thread "main" oracle.jbo.DMLException: JBO-26041: Failed to post data to database during "Insert": SQL Statement *****

     Caused by: java.sql.SQLException: ORA-32795: cannot insert into a generated always identity column

This is the expected behavior as the SQL formed is trying to insert a value into an identity field.

This post has been answered by User13332910-Oracle on Mar 30 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 27 2017
Added on Mar 28 2017
4 comments
1,549 views