Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.0.0-M2
    • None
    • jdbc
    • None
    • Os X, Linux, Postgres 8.[3|4], 8.[3|4] JDBC drivers

    Description

      When native sequence is set for Postgres in persistence.xml, i.e.

      <property name="openjpa.Sequence" value="native(Allocate=500, Increment=1)"/>

      subsequent schema synchronizations like "add" or "drop,add"

      (i.e.:<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(SchemaAction='add',primaryKeys=true,foreignKeys=true,indexes=true)"/>
      or <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(SchemaAction='drop,add',primaryKeys=true,foreignKeys=true,indexes=true)"/>

      when some sequences are already there result in SQL exception since apparently the DB catalog for sequences is not checked against their existence:

      Exception in thread "main" <openjpa-2.0.0-SNAPSHOT-r422266:805841 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: ERROR: relation "someseqence" already exists

      {stmnt 1582545914 CREATE SEQUENCE schema.somesequence START WITH 1 CACHE 500}

      [code=0, state=42P07]
      at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:553)
      at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:453)
      at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:158)
      at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:162)
      at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:118)
      at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:201)
      at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:152)
      at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:199)
      at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:150)
      at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:56)
      ...

      This prohibits updating schema without deletion of the existing sequences.

      Attachments

        Activity

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

          People

            Unassigned Unassigned
            yazuna Krzysztof Nienartowicz

            Dates

              Created:
              Updated:

              Slack

                Issue deployment