Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2883

UseTriggersForAutoAssign in Oracle seems to be broken

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.2.0
    • 3.2.1
    • jdbc
    • None

    Description

      Everything works as expected in openjpa:3.1.2

      In case Oracle DB is used and Entity has @GeneratedValue(strategy = GenerationType.IDENTITY) annotation
      The following error is thrown:

      Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: ORA-32795: cannot insert into a generated always identity column
       {stmnt 2049051802 CREATE OR REPLACE TRIGGER PObjectNative_id_TRG BEFORE INSERT ON PObjectNative FOR EACH ROW BEGIN SELECT PObjectNative_id_SEQ.nextval INTO :new.id FROM DUAL; END PObjectNative_id_TRG;} [code=32795, state=99999]
      	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:219)
      	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:203)
      	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$700(LoggingConnectionDecorator.java:58)
      	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:955)
      	at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:123)
      	at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1375)
      	at org.apache.openjpa.jdbc.schema.SchemaTool.createTable(SchemaTool.java:1114)
      	at org.apache.openjpa.jdbc.schema.SchemaTool.buildSchema(SchemaTool.java:660)
      	at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:565)
      	at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:400)
      	at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:372)
      	at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:571)
      	... 36 more
      

      The issue seems to be caused by introducing "GENERATED ALWAYS AS IDENTITY" in 3.2.0

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            solomax Maxim Solodovnik
            solomax Maxim Solodovnik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment