5 Replies Latest reply: Jul 19, 2013 11:39 AM by 1010689 RSS

    ADF Fires Insert Statement for an Update in adf Table

    1010689

      Hi,

      I'm using Jdeveloper 11.1.2.3.0.

      I have an editable table on a jsf page and a commit button to save the changes.

      I have overridden doDML method in entityImpl just to print whether INSERT/UPDATE/DELETE is issued.

       

          protected void doDML(int i, TransactionEvent transactionEvent) {

              System.out.println("Transaction Event: "+i);

              super.doDML(i, transactionEvent);

          }

       

      When i changed a column value in the table and click on Commit, the value is 2 (DML_UPDATE) when i run in my integrated weblogic server.

      But, when i run the same application from Standalone server, the value is 1 (DML_INSERT) and failing to post the data, below is part of the log message.

       

      Looks very strange behavior.

      Can anybody suggest how to get rid of this issue?

       

      Transaction Event: 1

      <Jul 18, 2013 9:09:35 PM GMT> <Error> <xxxxxx.XXXXXXBean> <BEA-000000> <oracle.jbo.DMLException: JBO-26041: Failed to post data to database during "Insert": SQL Statement "INSERT INTO APPS.TABLE_NAME(UPDATED_COLUMN_NAME) VALUES (:1)".>

      <Jul 18, 2013 9:09:35 PM GMT> <Warning> <oracle.adf.controller.faces.lifecycle.Utils> <BEA-000000> <ADF: Adding the following JSF error message: ORA-01400: cannot insert NULL into ("APPS"."TABLE_NAME"."FIRST_NOT_NULL_COLUMN")

       

       

      java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into ("APPS"."TABLE_NAME"."FIRST_NOT_NULL_COLUMN")

       

      Thanks,

      Vinod

        • 1. Re: ADF Fires Insert Statement for an Update in adf Table
          Timo Hahn

          Have you checked if the stand alone wls is running on the right adf runtime for your Jdev version?

          Is the wls connected to the same db?

          Which db driver type do you use to connect to the db on the wls?

           

          Timo

          • 2. Re: ADF Fires Insert Statement for an Update in adf Table
            1010689

            Hi Timo,

            Thanks for your response.

             

            1. We are on the correct runtime version for my jdev version.

            2. DB is different, integrated weblogic server is connected to my development environment, standalone is connected to Production database.

            3. we are using the drive oracle.jdbc.OracleDriver

             

            Thanks,

            Vinod

            • 3. Re: ADF Fires Insert Statement for an Update in adf Table
              1010689

              Hi Timo,

              When i run the application in integrated server using the production db, i'm getting the same error.

               

              I'm not sure why the code behavior is different based on the DB connection.

               

              When i call plsql prgram from AMImpl and issue commit in the plsql, it is committing successfully.

               

              Thanks,

              Vinod

              • 4. Re: ADF Fires Insert Statement for an Update in adf Table
                1010689

                i have set -Djbo.debugoutput=console for both model and view controller projects. Compared the logs in success case and issue case.

                 

                The difference is that Lock Entity part. Can anybody suggest whats wrong here?

                 

                Success Case:

                <ADFLogger> <begin> Commit transaction

                <OracleSQLBuilderImpl> <setSavepoint> [5534] OracleSQLBuilder: SAVEPOINT 'BO_SP'

                <ADFLogger> <begin> Posting the entity's changes

                <ADFLogger> <begin> Lock Entity

                <OracleSQLBuilderImpl> <doEntitySelectForAltKey> [5535] OracleSQLBuilder Executing doEntitySelect on: APPS.TABLE_NAME (true)

                <ADFLogger> <begin> Entity read all attributes

                <OracleSQLBuilderImpl> <buildSelectString> [5536] Built select: 'COLUMN1, COLUMN2, COLUMN3 FROM APPS.TABLE_NAME xxxxxxxxxxEO'

                <OracleSQLBuilderImpl> <doEntitySelectForAltKey> [5537] Executing LOCK...SELECT COLUMN1, COLUMN2, COLUMN3 FROM APPS.TABLE_NAME EO WHERE PRIMARY_KEY_COLUMN=:1 FOR UPDATE NOWAIT

                <ADFLogger> <addContextData> Entity read all attributes

                <OracleSQLBuilderImpl> <bindWhereAttrValue> [5538] Where binding param 1: 82754

                <ADFLogger> <addContextData> Entity read all attributes

                <ADFLogger> <end> Entity read all attributes

                <ADFLogger> <end> Lock Entity

                <ADFLogger> <begin> Before posting the entity's changes

                <ADFLogger> <begin> Updating audit columns

                <ADFLogger> <end> Updating audit columns

                <ADFLogger> <end> Before posting the entity's changes

                Transaction Event: 2

                <OracleSQLBuilderImpl> <doEntityDML> [5539] OracleSQLBuilder Executing, Lock 2 DML on: APPS.TABLE_NAME (Update)

                <OracleSQLBuilderImpl> <buildUpdateStatement> [5540] UPDATE buf xxxxxxxxxxEO>#u SQLStmtBufLen: 210, actual=85

                <OracleSQLBuilderImpl> <doEntityDML> [5541] UPDATE APPS.TABLE_NAME xxxxxxxxxxEO SET ATTRIBUTE1=:1 WHERE LINE_ID=:2

                <ADFLogger> <begin> Entity DML

                <OracleSQLBuilderImpl> <bindUpdateStatement> [5542] Update binding param 1: N

                <OracleSQLBuilderImpl> <bindWhereAttrValue> [5543] Where binding param 2: 82754

                 

                Error Case:

                <ADFLogger> <begin> Commit transaction

                <OracleSQLBuilderImpl> <setSavepoint> [4876] OracleSQLBuilder: SAVEPOINT 'BO_SP'

                <ADFLogger> <begin> Posting the entity's changes

                <ADFLogger> <begin> Before posting the entity's changes

                <ADFLogger> <begin> Updating audit columns

                <ADFLogger> <end> Updating audit columns

                <ADFLogger> <end> Before posting the entity's changes

                Transaction Event: 1

                <OracleSQLBuilderImpl> <doEntityDML> [4877] OracleSQLBuilder Executing, Lock 2 DML on: APPS.TABLE_NAME (Insert)

                <OracleSQLBuilderImpl> <buildInsertStatement> [4878] INSERT buf xxxxxxxxxxxxxxxxxEO>#i SQLStmtBufLen: 165, actual=62

                <OracleSQLBuilderImpl> <doEntityDML> [4879] INSERT INTO APPS.TABLE_NAME(ATTRIBUTE1) VALUES (:1)

                <ADFLogger> <begin> Entity DML

                <OracleSQLBuilderImpl> <bindInsertStatement> [4880] Insert binding param 1: Y

                <OracleSQLBuilderImpl> <doEntityDML> [4881] OracleSQLBuilderImpl.doEntityDML failed...

                <OracleSQLBuilderImpl> <doEntityDML> [4882] X/Open SQL State is: 23000

                <OracleSQLBuilderImpl> <doEntityDML> [4883] java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into ("APPS"."TABLE_NAME"."FIRST_NOT_NULL_COLUMN")

                 

                Thanks,

                Vinod

                • 5. Re: ADF Fires Insert Statement for an Update in adf Table
                  1010689

                  The issue is with the primary key used in my EO.

                   

                  In my production DB, primary key column that i used in EO is populated as NULL because it is not marked as PRIMARY KEY in the table.

                   

                  ADF BC could not find the primary key to update that is why trying to insert into the table. After updating the primary key in the database, issue is resolved.