You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "George Hongell (JIRA)" <ji...@apache.org> on 2007/07/04 02:28:04 UTC

[jira] Created: (OPENJPA-276) In a Resource Local Persistence Unit, when I create a second EntityManagerFactory, I lose the db2 database specific settings that I need (for ZOS DB2 V8) and which I got with the Entity Managers created from the first EntityManagerFactory that I created a

In a Resource Local Persistence Unit, when I create a second EntityManagerFactory, I lose the db2 database specific settings that I need (for ZOS DB2 V8) and which I got with the Entity Managers created from the first EntityManagerFactory that I created a
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: OPENJPA-276
                 URL: https://issues.apache.org/jira/browse/OPENJPA-276
             Project: OpenJPA
          Issue Type: Bug
         Environment: <1.0.0-SNAPSHOT-SNAPSHOT nonfatal user error> 
            Reporter: George Hongell
             Fix For: 1.1.0


In a Resource Local Persistence Unit, when I create a second EntityManagerFactory, I lose the db2 database specific settings that I need (for ZOS DB2 V8) and which I got with the Entity Managers created from the first EntityManagerFactory that I created and now I get the default db2 properties.

NOTE that this only happens when I use the openjpa specific connection properties.  When I use openjpa.ConnectionProperties with dbcp, it does not happen, I always get the correct properties.
NOTE that this casting behavour also happens with join columns.

In the following test case, the first EntityManagerFactory and EntityManager is created in setUp().  In testSQLQuery(), the same EntityManagerFactory is used to create a new EntityManager and the casting behavior of the int literal in the generated sql is correct (DECIMAL 31,0).
1640  mdd  TRACE  [main] openjpa.jdbc.SQL - <t 1094861122, conn 569516530> executing prepstmnt 489168168 SELECT t0.id, t0.age, t0.firstName, t0.lastName FROM jpaquer.XYZ t0 WHERE (CAST(t0.age AS DECIMAL(31,0)) = CAST(? AS DECIMAL(31,0)))  optimize for 1 row [params=(long) 20]

 In testSQLQuery2(), a new EntityManagerFactory is used to create a new EntityManager and the casting behavior of  the int literal in the generated sql is incorrect (BIGINT) which fails because the database does not support the bigint type.
<1.0.0-SNAPSHOT-SNAPSHOT nonfatal user error> org.apache.openjpa.persistence.ArgumentException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: BIGINT {prepstmnt 325325668 SELECT t0.id, t0.age, t0.firstName, t0.lastName FROM jpaquer.XYZ t0 WHERE (CAST(t0.age AS BIGINT) = CAST(? AS BIGINT))  optimize for 1 row [params=(long) 20]} [code=-204, state=42704]

<?xml version="1.0"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
    version="1.0">

    <persistence-unit name="mdd" transaction-type="RESOURCE_LOCAL">
       <class>com.ibm.ws.query.entities.annotated.Person</class> 
         <properties>
	
<!--
   <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource" />
                <property name="openjpa.ConnectionProperties"
value="DriverClassName=com.ibm.db2.jcc.DB2Driver,Url=jdbc:db2://localhost:50000/myzdb28,Username=hongell,Password=hts24las" />
-->
               <property name="openjpa.ConnectionDriverName" value="com.ibm.db2.jcc.DB2Driver"/>
               <property name="openjpa.ConnectionURL" value="jdbc:db2://localhost:50000/MYZDB28"/>
               <property name="openjpa.ConnectionUserName" value="hongell"/>
               <property name="openjpa.ConnectionPassword" value="las25tgl"/>

<!--SynchronizeMappings must be turned off for zdb28 - currently no stored proc SQLCOLUMNS, SQLFOREIGNKEYS -->
<!--
               <property name="openjpa.jdbc.SynchronizeMappings"  value="buildSchema(ForeignKeys=true)" />
-->				
               <property name="openjpa.Log" value="Enhance=TRACE,Query=TRACE,SQL=TRACE" />
        </properties>
    </persistence-unit>
</persistence>


<1.0.0-SNAPSHOT-SNAPSHOT nonfatal user error> org.apache.openjpa.persistence.ArgumentException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: BIGINT {prepstmnt 325325668 SELECT t0.id, t0.age, t0.firstName, t0.lastName FROM jpaquer.XYZ t0 WHERE (CAST(t0.age AS BIGINT) = CAST(? AS BIGINT))  optimize for 1 row [params=(long) 20]} [code=-204, state=42704]
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:805)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:766)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:762)
	at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:517)
	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:230)
	at org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:292)
	at com.ibm.ws.query.tests.JUEntityManagerFactoryTest.testSQLQuery2(JUEntityManagerFactoryTest.java:70)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:615)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: BIGINT {prepstmnt 325325668 SELECT t0.id, t0.age, t0.firstName, t0.lastName FROM jpaquer.XYZ t0 WHERE (CAST(t0.age AS BIGINT) = CAST(? AS BIGINT))  optimize for 1 row [params=(long) 20]} [code=-204, state=42704]
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:191)
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$800(LoggingConnectionDecorator.java:56)
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeQuery(LoggingConnectionDecorator.java:843)
	at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:262)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1372)
	at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:252)
	at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:368)
	at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:326)
	at org.apache.openjpa.jdbc.sql.LogicalUnion$UnionSelect.execute(LogicalUnion.java:407)
	at org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:218)
	at org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:208)
	at org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open(SelectResultObjectProvider.java:94)
	at org.apache.openjpa.kernel.QueryImpl.singleResult(QueryImpl.java:1275)
	at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1212)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:987)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:796)
	... 25 more

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


[jira] Updated: (OPENJPA-276) In a Resource Local Persistence Unit, when I create a second EntityManagerFactory, I lose the db2 database specific settings that I need (for ZOS DB2 V8) and which I got with the Entity Managers created from the first EntityManagerFactory that I created a

Posted by "Patrick Linskey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-276?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Linskey updated OPENJPA-276:
------------------------------------

    Fix Version/s:     (was: 1.1.0)
                   1.2.0

> In a Resource Local Persistence Unit, when I create a second EntityManagerFactory, I lose the db2 database specific settings that I need (for ZOS DB2 V8) and which I got with the Entity Managers created from the first EntityManagerFactory that I created a
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-276
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-276
>             Project: OpenJPA
>          Issue Type: Bug
>         Environment: <1.0.0-SNAPSHOT-SNAPSHOT nonfatal user error> 
>            Reporter: George Hongell
>             Fix For: 1.2.0
>
>         Attachments: JUEntityManagerFactoryTest.java
>
>
> In a Resource Local Persistence Unit, when I create a second EntityManagerFactory, I lose the db2 database specific settings that I need (for ZOS DB2 V8) and which I got with the Entity Managers created from the first EntityManagerFactory that I created and now I get the default db2 properties.
> NOTE that this only happens when I use the openjpa specific connection properties.  When I use openjpa.ConnectionProperties with dbcp, it does not happen, I always get the correct properties.
> NOTE that this casting behavour also happens with join columns.
> In the following test case, the first EntityManagerFactory and EntityManager is created in setUp().  In testSQLQuery(), the same EntityManagerFactory is used to create a new EntityManager and the casting behavior of the int literal in the generated sql is correct (DECIMAL 31,0).
> 1640  mdd  TRACE  [main] openjpa.jdbc.SQL - <t 1094861122, conn 569516530> executing prepstmnt 489168168 SELECT t0.id, t0.age, t0.firstName, t0.lastName FROM jpaquer.XYZ t0 WHERE (CAST(t0.age AS DECIMAL(31,0)) = CAST(? AS DECIMAL(31,0)))  optimize for 1 row [params=(long) 20]
>  In testSQLQuery2(), a new EntityManagerFactory is used to create a new EntityManager and the casting behavior of  the int literal in the generated sql is incorrect (BIGINT) which fails because the database does not support the bigint type.
> <1.0.0-SNAPSHOT-SNAPSHOT nonfatal user error> org.apache.openjpa.persistence.ArgumentException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: BIGINT {prepstmnt 325325668 SELECT t0.id, t0.age, t0.firstName, t0.lastName FROM jpaquer.XYZ t0 WHERE (CAST(t0.age AS BIGINT) = CAST(? AS BIGINT))  optimize for 1 row [params=(long) 20]} [code=-204, state=42704]
> <?xml version="1.0"?>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
>     version="1.0">
>     <persistence-unit name="mdd" transaction-type="RESOURCE_LOCAL">
>        <class>com.ibm.ws.query.entities.annotated.Person</class> 
>          <properties>
> 	
> <!--
>    <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource" />
>                 <property name="openjpa.ConnectionProperties"
> value="DriverClassName=com.ibm.db2.jcc.DB2Driver,Url=jdbc:db2://localhost:50000/myzdb28,Username=hongell,Password=hts24las" />
> -->
>                <property name="openjpa.ConnectionDriverName" value="com.ibm.db2.jcc.DB2Driver"/>
>                <property name="openjpa.ConnectionURL" value="jdbc:db2://localhost:50000/MYZDB28"/>
>                <property name="openjpa.ConnectionUserName" value="hongell"/>
>                <property name="openjpa.ConnectionPassword" value="las25tgl"/>
> <!--SynchronizeMappings must be turned off for zdb28 - currently no stored proc SQLCOLUMNS, SQLFOREIGNKEYS -->
> <!--
>                <property name="openjpa.jdbc.SynchronizeMappings"  value="buildSchema(ForeignKeys=true)" />
> -->				
>                <property name="openjpa.Log" value="Enhance=TRACE,Query=TRACE,SQL=TRACE" />
>         </properties>
>     </persistence-unit>
> </persistence>
> <1.0.0-SNAPSHOT-SNAPSHOT nonfatal user error> org.apache.openjpa.persistence.ArgumentException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: BIGINT {prepstmnt 325325668 SELECT t0.id, t0.age, t0.firstName, t0.lastName FROM jpaquer.XYZ t0 WHERE (CAST(t0.age AS BIGINT) = CAST(? AS BIGINT))  optimize for 1 row [params=(long) 20]} [code=-204, state=42704]
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:805)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:766)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:762)
> 	at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:517)
> 	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:230)
> 	at org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:292)
> 	at com.ibm.ws.query.tests.JUEntityManagerFactoryTest.testSQLQuery2(JUEntityManagerFactoryTest.java:70)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:615)
> 	at junit.framework.TestCase.runTest(TestCase.java:168)
> 	at junit.framework.TestCase.runBare(TestCase.java:134)
> 	at junit.framework.TestResult$1.protect(TestResult.java:110)
> 	at junit.framework.TestResult.runProtected(TestResult.java:128)
> 	at junit.framework.TestResult.run(TestResult.java:113)
> 	at junit.framework.TestCase.run(TestCase.java:124)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:232)
> 	at junit.framework.TestSuite.run(TestSuite.java:227)
> 	at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: BIGINT {prepstmnt 325325668 SELECT t0.id, t0.age, t0.firstName, t0.lastName FROM jpaquer.XYZ t0 WHERE (CAST(t0.age AS BIGINT) = CAST(? AS BIGINT))  optimize for 1 row [params=(long) 20]} [code=-204, state=42704]
> 	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:191)
> 	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$800(LoggingConnectionDecorator.java:56)
> 	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeQuery(LoggingConnectionDecorator.java:843)
> 	at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:262)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1372)
> 	at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:252)
> 	at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:368)
> 	at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:326)
> 	at org.apache.openjpa.jdbc.sql.LogicalUnion$UnionSelect.execute(LogicalUnion.java:407)
> 	at org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:218)
> 	at org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:208)
> 	at org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open(SelectResultObjectProvider.java:94)
> 	at org.apache.openjpa.kernel.QueryImpl.singleResult(QueryImpl.java:1275)
> 	at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1212)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:987)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:796)
> 	... 25 more

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


[jira] Updated: (OPENJPA-276) In a Resource Local Persistence Unit, when I create a second EntityManagerFactory, I lose the db2 database specific settings that I need (for ZOS DB2 V8) and which I got with the Entity Managers created from the first EntityManagerFactory that I created a

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-276?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick updated OPENJPA-276:
---------------------------------

    Fix Version/s:     (was: 1.2.0)
                   1.3.0
                   1.2.1

Moving to next release

> In a Resource Local Persistence Unit, when I create a second EntityManagerFactory, I lose the db2 database specific settings that I need (for ZOS DB2 V8) and which I got with the Entity Managers created from the first EntityManagerFactory that I created a
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-276
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-276
>             Project: OpenJPA
>          Issue Type: Bug
>         Environment: <1.0.0-SNAPSHOT-SNAPSHOT nonfatal user error> 
>            Reporter: George Hongell
>             Fix For: 1.2.1, 1.3.0
>
>         Attachments: JUEntityManagerFactoryTest.java
>
>
> In a Resource Local Persistence Unit, when I create a second EntityManagerFactory, I lose the db2 database specific settings that I need (for ZOS DB2 V8) and which I got with the Entity Managers created from the first EntityManagerFactory that I created and now I get the default db2 properties.
> NOTE that this only happens when I use the openjpa specific connection properties.  When I use openjpa.ConnectionProperties with dbcp, it does not happen, I always get the correct properties.
> NOTE that this casting behavour also happens with join columns.
> In the following test case, the first EntityManagerFactory and EntityManager is created in setUp().  In testSQLQuery(), the same EntityManagerFactory is used to create a new EntityManager and the casting behavior of the int literal in the generated sql is correct (DECIMAL 31,0).
> 1640  mdd  TRACE  [main] openjpa.jdbc.SQL - <t 1094861122, conn 569516530> executing prepstmnt 489168168 SELECT t0.id, t0.age, t0.firstName, t0.lastName FROM jpaquer.XYZ t0 WHERE (CAST(t0.age AS DECIMAL(31,0)) = CAST(? AS DECIMAL(31,0)))  optimize for 1 row [params=(long) 20]
>  In testSQLQuery2(), a new EntityManagerFactory is used to create a new EntityManager and the casting behavior of  the int literal in the generated sql is incorrect (BIGINT) which fails because the database does not support the bigint type.
> <1.0.0-SNAPSHOT-SNAPSHOT nonfatal user error> org.apache.openjpa.persistence.ArgumentException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: BIGINT {prepstmnt 325325668 SELECT t0.id, t0.age, t0.firstName, t0.lastName FROM jpaquer.XYZ t0 WHERE (CAST(t0.age AS BIGINT) = CAST(? AS BIGINT))  optimize for 1 row [params=(long) 20]} [code=-204, state=42704]
> <?xml version="1.0"?>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
>     version="1.0">
>     <persistence-unit name="mdd" transaction-type="RESOURCE_LOCAL">
>        <class>com.ibm.ws.query.entities.annotated.Person</class> 
>          <properties>
> 	
> <!--
>    <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource" />
>                 <property name="openjpa.ConnectionProperties"
> value="DriverClassName=com.ibm.db2.jcc.DB2Driver,Url=jdbc:db2://localhost:50000/myzdb28,Username=hongell,Password=hts24las" />
> -->
>                <property name="openjpa.ConnectionDriverName" value="com.ibm.db2.jcc.DB2Driver"/>
>                <property name="openjpa.ConnectionURL" value="jdbc:db2://localhost:50000/MYZDB28"/>
>                <property name="openjpa.ConnectionUserName" value="hongell"/>
>                <property name="openjpa.ConnectionPassword" value="las25tgl"/>
> <!--SynchronizeMappings must be turned off for zdb28 - currently no stored proc SQLCOLUMNS, SQLFOREIGNKEYS -->
> <!--
>                <property name="openjpa.jdbc.SynchronizeMappings"  value="buildSchema(ForeignKeys=true)" />
> -->				
>                <property name="openjpa.Log" value="Enhance=TRACE,Query=TRACE,SQL=TRACE" />
>         </properties>
>     </persistence-unit>
> </persistence>
> <1.0.0-SNAPSHOT-SNAPSHOT nonfatal user error> org.apache.openjpa.persistence.ArgumentException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: BIGINT {prepstmnt 325325668 SELECT t0.id, t0.age, t0.firstName, t0.lastName FROM jpaquer.XYZ t0 WHERE (CAST(t0.age AS BIGINT) = CAST(? AS BIGINT))  optimize for 1 row [params=(long) 20]} [code=-204, state=42704]
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:805)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:766)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:762)
> 	at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:517)
> 	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:230)
> 	at org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:292)
> 	at com.ibm.ws.query.tests.JUEntityManagerFactoryTest.testSQLQuery2(JUEntityManagerFactoryTest.java:70)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:615)
> 	at junit.framework.TestCase.runTest(TestCase.java:168)
> 	at junit.framework.TestCase.runBare(TestCase.java:134)
> 	at junit.framework.TestResult$1.protect(TestResult.java:110)
> 	at junit.framework.TestResult.runProtected(TestResult.java:128)
> 	at junit.framework.TestResult.run(TestResult.java:113)
> 	at junit.framework.TestCase.run(TestCase.java:124)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:232)
> 	at junit.framework.TestSuite.run(TestSuite.java:227)
> 	at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: BIGINT {prepstmnt 325325668 SELECT t0.id, t0.age, t0.firstName, t0.lastName FROM jpaquer.XYZ t0 WHERE (CAST(t0.age AS BIGINT) = CAST(? AS BIGINT))  optimize for 1 row [params=(long) 20]} [code=-204, state=42704]
> 	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:191)
> 	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$800(LoggingConnectionDecorator.java:56)
> 	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeQuery(LoggingConnectionDecorator.java:843)
> 	at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:262)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1372)
> 	at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:252)
> 	at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:368)
> 	at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:326)
> 	at org.apache.openjpa.jdbc.sql.LogicalUnion$UnionSelect.execute(LogicalUnion.java:407)
> 	at org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:218)
> 	at org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:208)
> 	at org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open(SelectResultObjectProvider.java:94)
> 	at org.apache.openjpa.kernel.QueryImpl.singleResult(QueryImpl.java:1275)
> 	at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1212)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:987)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:796)
> 	... 25 more

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


[jira] Updated: (OPENJPA-276) In a Resource Local Persistence Unit, when I create a second EntityManagerFactory, I lose the db2 database specific settings that I need (for ZOS DB2 V8) and which I got with the Entity Managers created from the first EntityManagerFactory that I created a

Posted by "George Hongell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-276?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

George Hongell updated OPENJPA-276:
-----------------------------------

    Attachment: JUEntityManagerFactoryTest.java

test case for issue 276

CREATE TABLE jpaquer.XYZ (id INTEGER NOT NULL, age INTEGER, firstName VARCHAR(20), lastName VARCHAR(20), PRIMARY KEY (id));


> In a Resource Local Persistence Unit, when I create a second EntityManagerFactory, I lose the db2 database specific settings that I need (for ZOS DB2 V8) and which I got with the Entity Managers created from the first EntityManagerFactory that I created a
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-276
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-276
>             Project: OpenJPA
>          Issue Type: Bug
>         Environment: <1.0.0-SNAPSHOT-SNAPSHOT nonfatal user error> 
>            Reporter: George Hongell
>             Fix For: 1.1.0
>
>         Attachments: JUEntityManagerFactoryTest.java
>
>
> In a Resource Local Persistence Unit, when I create a second EntityManagerFactory, I lose the db2 database specific settings that I need (for ZOS DB2 V8) and which I got with the Entity Managers created from the first EntityManagerFactory that I created and now I get the default db2 properties.
> NOTE that this only happens when I use the openjpa specific connection properties.  When I use openjpa.ConnectionProperties with dbcp, it does not happen, I always get the correct properties.
> NOTE that this casting behavour also happens with join columns.
> In the following test case, the first EntityManagerFactory and EntityManager is created in setUp().  In testSQLQuery(), the same EntityManagerFactory is used to create a new EntityManager and the casting behavior of the int literal in the generated sql is correct (DECIMAL 31,0).
> 1640  mdd  TRACE  [main] openjpa.jdbc.SQL - <t 1094861122, conn 569516530> executing prepstmnt 489168168 SELECT t0.id, t0.age, t0.firstName, t0.lastName FROM jpaquer.XYZ t0 WHERE (CAST(t0.age AS DECIMAL(31,0)) = CAST(? AS DECIMAL(31,0)))  optimize for 1 row [params=(long) 20]
>  In testSQLQuery2(), a new EntityManagerFactory is used to create a new EntityManager and the casting behavior of  the int literal in the generated sql is incorrect (BIGINT) which fails because the database does not support the bigint type.
> <1.0.0-SNAPSHOT-SNAPSHOT nonfatal user error> org.apache.openjpa.persistence.ArgumentException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: BIGINT {prepstmnt 325325668 SELECT t0.id, t0.age, t0.firstName, t0.lastName FROM jpaquer.XYZ t0 WHERE (CAST(t0.age AS BIGINT) = CAST(? AS BIGINT))  optimize for 1 row [params=(long) 20]} [code=-204, state=42704]
> <?xml version="1.0"?>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
>     version="1.0">
>     <persistence-unit name="mdd" transaction-type="RESOURCE_LOCAL">
>        <class>com.ibm.ws.query.entities.annotated.Person</class> 
>          <properties>
> 	
> <!--
>    <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource" />
>                 <property name="openjpa.ConnectionProperties"
> value="DriverClassName=com.ibm.db2.jcc.DB2Driver,Url=jdbc:db2://localhost:50000/myzdb28,Username=hongell,Password=hts24las" />
> -->
>                <property name="openjpa.ConnectionDriverName" value="com.ibm.db2.jcc.DB2Driver"/>
>                <property name="openjpa.ConnectionURL" value="jdbc:db2://localhost:50000/MYZDB28"/>
>                <property name="openjpa.ConnectionUserName" value="hongell"/>
>                <property name="openjpa.ConnectionPassword" value="las25tgl"/>
> <!--SynchronizeMappings must be turned off for zdb28 - currently no stored proc SQLCOLUMNS, SQLFOREIGNKEYS -->
> <!--
>                <property name="openjpa.jdbc.SynchronizeMappings"  value="buildSchema(ForeignKeys=true)" />
> -->				
>                <property name="openjpa.Log" value="Enhance=TRACE,Query=TRACE,SQL=TRACE" />
>         </properties>
>     </persistence-unit>
> </persistence>
> <1.0.0-SNAPSHOT-SNAPSHOT nonfatal user error> org.apache.openjpa.persistence.ArgumentException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: BIGINT {prepstmnt 325325668 SELECT t0.id, t0.age, t0.firstName, t0.lastName FROM jpaquer.XYZ t0 WHERE (CAST(t0.age AS BIGINT) = CAST(? AS BIGINT))  optimize for 1 row [params=(long) 20]} [code=-204, state=42704]
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:805)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:766)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:762)
> 	at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:517)
> 	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:230)
> 	at org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:292)
> 	at com.ibm.ws.query.tests.JUEntityManagerFactoryTest.testSQLQuery2(JUEntityManagerFactoryTest.java:70)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:615)
> 	at junit.framework.TestCase.runTest(TestCase.java:168)
> 	at junit.framework.TestCase.runBare(TestCase.java:134)
> 	at junit.framework.TestResult$1.protect(TestResult.java:110)
> 	at junit.framework.TestResult.runProtected(TestResult.java:128)
> 	at junit.framework.TestResult.run(TestResult.java:113)
> 	at junit.framework.TestCase.run(TestCase.java:124)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:232)
> 	at junit.framework.TestSuite.run(TestSuite.java:227)
> 	at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: BIGINT {prepstmnt 325325668 SELECT t0.id, t0.age, t0.firstName, t0.lastName FROM jpaquer.XYZ t0 WHERE (CAST(t0.age AS BIGINT) = CAST(? AS BIGINT))  optimize for 1 row [params=(long) 20]} [code=-204, state=42704]
> 	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:191)
> 	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$800(LoggingConnectionDecorator.java:56)
> 	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeQuery(LoggingConnectionDecorator.java:843)
> 	at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:262)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1372)
> 	at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:252)
> 	at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:368)
> 	at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:326)
> 	at org.apache.openjpa.jdbc.sql.LogicalUnion$UnionSelect.execute(LogicalUnion.java:407)
> 	at org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:218)
> 	at org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:208)
> 	at org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open(SelectResultObjectProvider.java:94)
> 	at org.apache.openjpa.kernel.QueryImpl.singleResult(QueryImpl.java:1275)
> 	at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1212)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:987)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:796)
> 	... 25 more

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