Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 94240 invoked from network); 30 Jul 2008 16:22:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Jul 2008 16:22:24 -0000 Received: (qmail 86329 invoked by uid 500); 30 Jul 2008 16:22:22 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 86299 invoked by uid 500); 30 Jul 2008 16:22:22 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 86285 invoked by uid 99); 30 Jul 2008 16:22:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jul 2008 09:22:22 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jul 2008 16:21:35 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id A4F3F234C181 for ; Wed, 30 Jul 2008 09:21:31 -0700 (PDT) Message-ID: <1497637532.1217434891660.JavaMail.jira@brutus> Date: Wed, 30 Jul 2008 09:21:31 -0700 (PDT) From: "Michael Dick (JIRA)" To: dev@openjpa.apache.org Subject: [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 In-Reply-To: <23030702.1183508884447.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on 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 - 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] > > 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"> > > com.ibm.ws.query.entities.annotated.Person > > > > > > > > > > > > > > <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.