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.
-
You can reply to this email to add a comment to the issue online.