[
https://issues.apache.org/jira/browse/OPENJPA-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13699032#comment-13699032
]
Joerg Knoche commented on OPENJPA-1259:
---------------------------------------
Since this bug got no attention in nearly 4 years, I just wanted to confirm
that this bug still exists in version 2.2.2.
> Postgres
> --------
>
> Key: OPENJPA-1259
> URL: https://issues.apache.org/jira/browse/OPENJPA-1259
> Project: OpenJPA
> Issue Type: Bug
> Components: jdbc
> Affects Versions: 2.0.0-M2
> Environment: Os X, Linux, Postgres 8.[3|4], 8.[3|4] JDBC drivers
> Reporter: Krzysztof
> Priority: Minor
>
> 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.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira