You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "Knut-Håvard Aksnes (JIRA)" <ji...@apache.org> on 2010/07/17 21:07:49 UTC

[jira] Created: (GERONIMO-5451) JPA table generation fails on JTA datasources

JPA table generation fails on JTA datasources
---------------------------------------------

                 Key: GERONIMO-5451
                 URL: https://issues.apache.org/jira/browse/GERONIMO-5451
             Project: Geronimo
          Issue Type: Bug
      Security Level: public (Regular issues)
    Affects Versions: 2.1.6, 2.1.5
         Environment: Vista using current Java 1.6 and embedded Derby
            Reporter: Knut-Håvard Aksnes


I am calling a number of JPA beans from a local Web service implemented via JAX-WS annotations and  Stateless Session Bean.
Table creation fails due to some operations during table creation being run outside a transaction context.
 
Workaround:

First set up the Database Pool and persistence.xml to use a Local(Non JTA) setup. Table creation will succeed, but the rest of my code will fail.
Then uninstalling my EAR and removing the DBPool, but keeping the Local Derby database.
Then creating new JTA enabled DB pool for the same underlaying database, fixing the persistence.xml, rebuild the EAR, and reinstall.
As this has to be done everytime OpenJPA needs to update tables this is a major hassle during development.

If the workaround hadn't required so much work this would have been a minor bug.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (GERONIMO-5451) JPA table generation fails on JTA datasources

Posted by "David Jencks (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GERONIMO-5451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12889920#action_12889920 ] 

David Jencks commented on GERONIMO-5451:
----------------------------------------

Even if using only the jta-datasource works with other databases, it's almost certain to be slower than using both a jta and non-jta datasource, at the cost of a few more lightly-used database connections.  Openjpa needs to use a non-transactional db connection for both creating tables and for fetching new key values.  If you don't supply extra non-transactional connections for it to use it will try to use the xa connection it already has by suspending the jta tx, fetching the new key value(s), and resuming the tx.  This involves at least 2 extra calls to the db, which are apt to be particularly slow because most db vendors don't really expect you to ever call suspend/resume.  My observations (from several years ago) on derby is that after the suspend or resume it has forgotten what db you are talking to.

In any case, if you want to use only the one jta datasource, and are having problems, you should take it up with openjpa or the database vendor.

> JPA table generation fails on JTA datasources
> ---------------------------------------------
>
>                 Key: GERONIMO-5451
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5451
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>    Affects Versions: 2.1.5, 2.1.6
>         Environment: Vista using current Java 1.6 and embedded Derby
>            Reporter: Knut-Håvard Aksnes
>
> I am calling a number of JPA beans from a local Web service implemented via JAX-WS annotations and  Stateless Session Bean.
> Table creation fails due to some operations during table creation being run outside a transaction context.
>  
> Workaround:
> First set up the Database Pool and persistence.xml to use a Local(Non JTA) setup. Table creation will succeed, but the rest of my code will fail.
> Then uninstalling my EAR and removing the DBPool, but keeping the Local Derby database.
> Then creating new JTA enabled DB pool for the same underlaying database, fixing the persistence.xml, rebuild the EAR, and reinstall.
> As this has to be done everytime OpenJPA needs to update tables this is a major hassle during development.
> If the workaround hadn't required so much work this would have been a minor bug.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (GERONIMO-5451) JPA table generation fails on JTA datasources

Posted by "David Jencks (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GERONIMO-5451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12889531#action_12889531 ] 

David Jencks commented on GERONIMO-5451:
----------------------------------------

My experience is that jpa + derby _only_ works if you have _both_ a jta-datasource and a non-jta-datasource and they are really transactional and non-transactional (i.e. the non-jta-datasource is set up with no-transactions).  If not, there are a lot of operations besides DDL statements that just don't work.  Do you have both configured?

> JPA table generation fails on JTA datasources
> ---------------------------------------------
>
>                 Key: GERONIMO-5451
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5451
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>    Affects Versions: 2.1.5, 2.1.6
>         Environment: Vista using current Java 1.6 and embedded Derby
>            Reporter: Knut-Håvard Aksnes
>
> I am calling a number of JPA beans from a local Web service implemented via JAX-WS annotations and  Stateless Session Bean.
> Table creation fails due to some operations during table creation being run outside a transaction context.
>  
> Workaround:
> First set up the Database Pool and persistence.xml to use a Local(Non JTA) setup. Table creation will succeed, but the rest of my code will fail.
> Then uninstalling my EAR and removing the DBPool, but keeping the Local Derby database.
> Then creating new JTA enabled DB pool for the same underlaying database, fixing the persistence.xml, rebuild the EAR, and reinstall.
> As this has to be done everytime OpenJPA needs to update tables this is a major hassle during development.
> If the workaround hadn't required so much work this would have been a minor bug.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (GERONIMO-5451) JPA table generation fails on JTA datasources

Posted by "Knut-Håvard Aksnes (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GERONIMO-5451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12889850#action_12889850 ] 

Knut-Håvard Aksnes commented on GERONIMO-5451:
----------------------------------------------

My workaround seems to work on 2.1.6 but not on 2.1.5. 
I don't have both set up at the same time. I am really only interested in using JTA. The switching trick works, but is ugly.The project I am working on are at a fairly early stage and Derby is likely to be switched to some kind of enterprise database platform before deployment, but Embedded Derby is nice "If it works" during development as it is low overhead and "Zero config". The production database is likely to be running on SqlServer or Oracle depending on where we decide to deploy.

> JPA table generation fails on JTA datasources
> ---------------------------------------------
>
>                 Key: GERONIMO-5451
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5451
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>    Affects Versions: 2.1.5, 2.1.6
>         Environment: Vista using current Java 1.6 and embedded Derby
>            Reporter: Knut-Håvard Aksnes
>
> I am calling a number of JPA beans from a local Web service implemented via JAX-WS annotations and  Stateless Session Bean.
> Table creation fails due to some operations during table creation being run outside a transaction context.
>  
> Workaround:
> First set up the Database Pool and persistence.xml to use a Local(Non JTA) setup. Table creation will succeed, but the rest of my code will fail.
> Then uninstalling my EAR and removing the DBPool, but keeping the Local Derby database.
> Then creating new JTA enabled DB pool for the same underlaying database, fixing the persistence.xml, rebuild the EAR, and reinstall.
> As this has to be done everytime OpenJPA needs to update tables this is a major hassle during development.
> If the workaround hadn't required so much work this would have been a minor bug.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.