Hi,
No easy answers, but a few things to check on...
o I'm not an expert with Postgres, but it looks like OpenJPA has only been
tested with v8.4 [1]. I can't imagine that v9.1 introduced a problem in
this area, but it's something to be aware of. Has this scenario worked in
the past on any previous versions of Postgres and/or OpenJPA?
o There seems to be an issue with accessing the sequence as defined for
Postgres. How are you defining the Sequence in your Entity and/or orm.xml?
o Outputting the actual parameters to the SELECT pg_get_serial_sequence(?,
?) statement may be helpful since it will show the users and ids that are
being queried against. You can turn on this option by adding
PrintParameters=True to the ConnectionFactoryProperties property.
o For giggles, you could also remove the SchemaAction=add property. By
default, the buildSchema will attempt to synchronize between the object
model and the database. I'm not sure if the SchemaAction=add action is
causing the Postgres dictionary to take a slightly different path. Worth a
shot anyway.
Good luck,
Kevin
[1]
http://openjpa.apache.org/builds/latest/docs/docbook/manual.html#dbsupport
On Tue, Jun 5, 2012 at 3:10 AM, ubiteck <sursini@gmail.com> wrote:
> I'm using *OpenJPA 2.1.1* with *Postgres 9.1*. My persistence.xml file
> contains the following parameters :
>
>
> <property name="openjpa.jdbc.SynchronizeMappings"
> value="buildSchema(SchemaAction=add,ForeignKeys=true)" />
> <property name="openjpa.ConnectionFactoryProperties"
> value="PrettyPrint=true, PrettyPrintLineLength=200" />
> <property name="openjpa.jdbc.DBDictionary"
> value="postgres(SearchStringEscape=\)"/>
>
>
> I got a ReportingSQLException when JPA tries to get the name of a sequence
> to define the identity of my entity bean.
>
>
> *Exception stack trace*
>
> 2012-06-04 23:09:24,038 WARN [JDBC] Unable to determine which sequences
> are
> owned by the database. OpenJPA will consider all sequences suffixed with
> "_seq" as database managed. This may result in improper creation or
> removal
> of sequences with this suffix. The original PostgreSQL driver exception is
> being logged for your reference.
> org.apache.openjpa.lib.jdbc.ReportingSQLException: ERROR: current
> transaction is aborted, commands ignored until end of transaction block
> {prepstmnt 155836080
> SELECT pg_get_serial_sequence(?, ?)
> [params=?, ?]} [code=0, state=25P02]
> at
>
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:281)
> at
>
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:257)
> at
>
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$1000(LoggingConnectionDecorator.java:72)
> at
>
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.execute(LoggingConnectionDecorator.java:1295)
> at
>
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:386)
> at
>
> org.apache.openjpa.jdbc.sql.PostgresDictionary.queryOwnership(PostgresDictionary.java:467)
> at
>
> org.apache.openjpa.jdbc.sql.PostgresDictionary.isOwnedSequence(PostgresDictionary.java:441)
> at
>
> org.apache.openjpa.jdbc.sql.PostgresDictionary.isSystemSequence(PostgresDictionary.java:409)
> at
>
> org.apache.openjpa.jdbc.schema.SchemaGenerator.generateSequences(SchemaGenerator.java:960)
> at
>
> org.apache.openjpa.jdbc.schema.SchemaGenerator.generateSchema(SchemaGenerator.java:367)
> at
>
> org.apache.openjpa.jdbc.schema.SchemaGenerator.generateSchemas(SchemaGenerator.java:300)
> at
>
> org.apache.openjpa.jdbc.schema.SchemaTool.getDBSchemaGroup(SchemaTool.java:1163)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:363)
> at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:340)
> at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:505)
> at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:456)
> at
>
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:160)
> at
>
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:164)
> at
>
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:122)
> at
>
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:210)
> at
>
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
> at
>
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
> at
>
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
> at
>
> org.apache.geronimo.persistence.CMPEntityManagerTxScoped.createEntityManager(CMPEntityManagerTxScoped.java:77)
> at
>
> org.apache.geronimo.persistence.CMPEntityManagerTxScoped.getEntityManager(CMPEntityManagerTxScoped.java:58)
> at
>
> org.apache.geronimo.persistence.CMPEntityManagerTxScoped.createNamedQuery(CMPEntityManagerTxScoped.java:419)
> ......
>
>
> Thanks in advance
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/PostgreSQL-9-1-Error-current-transaction-is-aborted-tp7580209.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
|