[
https://issues.apache.org/jira/browse/OPENJPA-2419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13732583#comment-13732583
]
Scott Parkerson commented on OPENJPA-2419:
------------------------------------------
Albert,
The good news is that, yes, using that property seems to at least try to use
the datasource2; however, the problem is that the Aries Transaction still blows
up. I don't understand why that is at the moment without looking at the code,
though.
Here's a snippet from the logs:
14:55:47,249 | INFO | tp1079313220-162 | Runtime |
266 - org.apache.openjpa - 2.2.2 | Starting OpenJPA 2.2.2
14:55:47,249 | TRACE | tp1079313220-162 | Runtime |
266 - org.apache.openjpa - 2.2.2 | Properties:
.
.
.
openjpa.jdbc.DBDictionary: nativeSequenceType=1
.
.
.
14:55:53,272 | TRACE | tp1079313220-162 | Runtime |
266 - org.apache.openjpa - 2.2.2 | Found datasource1: datasource 1720155521
from configuration. StoreContext: org.apache.openjpa.kernel.BrokerImpl@1ca9be7a
14:55:53,273 | TRACE | tp1079313220-162 | Runtime |
266 - org.apache.openjpa - 2.2.2 |
org.apache.openjpa.persistence.EntityManagerFactoryImpl@357273b1 created
EntityManager org.apache.openjpa.persistence.EntityManagerImpl@1ca9be7a.
14:55:53,273 | DEBUG | tp1079313220-162 | context |
137 - org.apache.aries.jpa.container.context - 1.0.1.redhat-60024 | Created a
new persistence context
org.apache.aries.jpa.container.impl.EntityManagerWrapper@4eb525a6 for
transaction
[Xid:globalId=ffffff9352225a401006f72672e6170616368652e61726965732e7472616e73616374696f6e0000000000000000000000000000,length=64,branchId=0000000000000000000000000000000000000000000000000000000000000000,length=64].
14:55:53,277 | TRACE | tp1079313220-162 | Runtime |
266 - org.apache.openjpa - 2.2.2 | Found datasource 2: datasource 1228985533
from config. StoreContext: org.apache.openjpa.kernel.BrokerImpl@1ca9be7a
14:55:53,278 | TRACE | tp1079313220-162 | SQL |
266 - org.apache.openjpa - 2.2.2 | <t 374616385, conn 318516908> executing
prepstmnt 291214003
ALTER SEQUENCE client.client_clientid_seq INCREMENT BY 50
14:55:53,282 | TRACE | tp1079313220-162 | SQL |
266 - org.apache.openjpa - 2.2.2 | <t 374616385, conn 318516908> [4 ms] spent
14:55:53,283 | WARN | tp1079313220-162 | Runtime |
266 - org.apache.openjpa - 2.2.2 | Unable to cache sequence values for sequence
"client.client_clientid_seq". Your application does not have permission to run
an ALTER SEQUENCE command. Ensure that it has the appropriate permission to run
an ALTER SEQUENCE command.
14:55:53,283 | TRACE | tp1079313220-162 | SQL |
266 - org.apache.openjpa - 2.2.2 | <t 374616385, conn 318516908> executing
prepstmnt 15932635
SELECT NEXTVAL('client.client_clientid_seq')
14:55:53,285 | TRACE | tp1079313220-162 | SQL |
266 - org.apache.openjpa - 2.2.2 | <t 374616385, conn 318516908> [2 ms] spent
14:55:53,292 | DEBUG | tp1079313220-162 | context |
137 - org.apache.aries.jpa.container.context - 1.0.1.redhat-60024 | Clearing up
EntityManager org.apache.aries.jpa.container.impl.EntityManagerWrapper@4eb525a6
as the transaction has completed.
14:55:53,292 | TRACE | tp1079313220-162 | Runtime |
266 - org.apache.openjpa - 2.2.2 |
[email protected]() invoked.
> Sequence Caching Attempt Failing in JTA Managed Environments with PostgreSQL
> ----------------------------------------------------------------------------
>
> Key: OPENJPA-2419
> URL: https://issues.apache.org/jira/browse/OPENJPA-2419
> Project: OpenJPA
> Issue Type: Bug
> Components: jdbc
> Affects Versions: 2.2.2
> Environment: Fuse (JBoss) ESB 6.0.0-redhat-024 (Karaf 2.3.0)
> OpenJPA 2.2.2
> Apache Aries 1.0.0 (JPA/JTA/JNDI/Blueprint)
> Reporter: Scott Parkerson
>
> About a year ago, there was a bug (OPENJPA-2196) that I contributed a patch
> to that deals with cases where OpenJPA's sequence caching cannot be used if
> the native sequence in the database is not owned by the role connecting to
> the database. This patch was included in OpenJPA 2.2.2.
> Since then, I've started using JTA-managed transactions in my container (the
> container being JBoss Fuse ESB, using Aries JPA/JNDI/JTA), and have hit the
> following snags with my previous fix:
> 1. When the attempt to ALTER SEQUENCE ... INCREMENT BY fails, it basically
> hoses the entire transaction, causing the next thing (which is to get the
> next value in the sequence) to fail because the transaction is now invalid
> and must be rolled back.
> 2. Trying to work around this using either ConnectionFactory2Name or the
> non-jta-data-source configuration items in my persistence.xml file seems to
> never matter, as ALL native sequences in OpenJPA are of type TYPE_CONTIGUOUS,
> and thus it will always choose the managed (jta-data-source or
> ConnectionFactoryName) methods to attempt to modify the sequence. I cannot
> see where it attempts to suspend the transaction, either.
> Perhaps there is a workaround, but I cannot see it. Does anyone else have any
> ideas on what could be done to make this work?
--
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