Patrick, On 4/24/07, Patrick Linskey <[EMAIL PROTECTED]> wrote:
> One way to do this would > be to package the work up in a Runnable and execute it in an > appropriate transactional environment. It might be easier to > understand if the sequence code had a similar implementation. We talked about this in a thread several months ago. I think that the conclusion was that it'd be neat to make our ManagedRuntime interface have a runInNewTransaction(Runnable) method, and to move things to use that instead of doing tx logic directly inside the sequence classes. This would be an easy change; the lack of a concrete need (i.e., a server that both denied transactional control and provided a means to execute a Runnable in a new tx) prevented us from changing things around.
A "concrete need" is surfacing with WebSphere. WebSphere does not allow for direct transactional control (ie. suspend/resume) and it has recently provided the means to execute a Runnable in a new Tx (via the "runUnderUOW" feature). Although WebSphere may be the exception to the rule, we are planning on providing the mechanism so that OpenJPA can play in this game. Kevin -Patrick
-- Patrick Linskey BEA Systems, Inc. _______________________________________________________________________ Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it. > -----Original Message----- > From: David Jencks [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 24, 2007 10:53 AM > To: open-jpa-dev@incubator.apache.org > Subject: Possible problem with ddl with only a jta-datasource > and sequences > > Using derby, jta transactions (in geronimo), a table > sequence, autocreation of tables, and only a jta-datasource, > I get errors complaining that the sequence table doesn't exist. > > Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: > Table/ View 'OPENJPASEQ' does not exist. {SELECT > SEQUENCE_VALUE FROM OPENJPASEQ WHERE ID = ? FOR UPDATE WITH > RR} [code=20000, state=42X05] > > If I supply a non-jta-datasource everything works fine. > > My current theory about why this is happening is that the ddl > to create all the tables is executed in a connection from the > jta- datasource that's enrolled in a jta transaction. Then > we go to get an id from the sequence, the jta transaction is > suspended, and a new tx is started, in which the ddl is not > visible since the jta tx wasn't committed. (apparently ddl in > derby is transactional) > > Does this seem like a reasonable explanation? > > I'm going to look for a way to run the ddl inside a separate > transaction that can be committed, the same as how sequences > work without a non-jta-datasource. One way to do this would > be to package the work up in a Runnable and execute it in an > appropriate transactional environment. It might be easier to > understand if the sequence code had a similar implementation. > > thanks > david jencks > > Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.