From dev-return-16607-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Mon Jun 07 15:46:24 2010 Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 89284 invoked from network); 7 Jun 2010 15:46:20 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 Jun 2010 15:46:20 -0000 Received: (qmail 64702 invoked by uid 500); 7 Jun 2010 15:46:20 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 64671 invoked by uid 500); 7 Jun 2010 15:46:20 -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 64663 invoked by uid 99); 7 Jun 2010 15:46:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jun 2010 15:46:20 +0000 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.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jun 2010 15:46:17 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o57FjtUs013933 for ; Mon, 7 Jun 2010 15:45:55 GMT Message-ID: <32170248.3321275925555401.JavaMail.jira@thor> Date: Mon, 7 Jun 2010 11:45:55 -0400 (EDT) From: "Pinaki Poddar (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-1682) TestSimpleXmlEntity.testId failed with invalid DB2 create table SQL statement In-Reply-To: <3953167.184311275667738330.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-1682?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D12= 876282#action_12876282 ]=20 Pinaki Poddar commented on OPENJPA-1682: ---------------------------------------- Can an unique column be nullable? The answer seems to vary across databases= . The observed DB2 error -542 points that DB2 does not allow a unique column = to be nullable. " column-name CANNOT BE A COLUMN OF A PRIMARY KEY, A UNIQUE CONSTRAINT, OR= A PARENT KEY BECAUSE IT CAN CONTAIN NULL VALUES Explanation : The code is used to report that a column identified in a PRIM= ARY KEY, a UNIQUE constraint clause, or a parent key (via a REFERENCES clau= se) is defined to allow null values." While MySQL seems to allow a null value on a column with unique constraint. OpenJPA currently works in a way that an unique constraint on a column *doe= s not imply* any nullability -- positive or negative. Earlier (prior to revision 941362), we forced that an unique constraint on = a column *does imply* non-nullability. But OPENJPA-1387 made the point that= unique constraint should not imply non-nullable -- whch I tend to agree an= d hence revision 941362 removed the implication. But as the current issue shows, we need to make this implication database d= ependent. =20 =20 > TestSimpleXmlEntity.testId failed with invalid DB2 create table SQL state= ment > -------------------------------------------------------------------------= ---- > > Key: OPENJPA-1682 > URL: https://issues.apache.org/jira/browse/OPENJPA-1682 > Project: OpenJPA > Issue Type: Bug > Components: sql > Affects Versions: 2.1.0 > Reporter: Albert Lee > > TestSimpleXmlEntity.testId starts failing with the following exception ag= ainst DB2: > TestSimpleXmlEntity.testId View test details (org.apache.openjpa.persi= stence.xml) > org.ap= ache.openjpa.persistence.PersistenceException: DB2 SQL Error: SQLCODE=3D-54= 2, SQLSTATE=3D42831, SQLERRMC=3DNICKNAME_XML, DRIVER=3D3.50.152 {stmnt 6540= 5926 CREATE TABLE NickNames_xml (A_ID_xml INTEGER NOT NULL, nickName_xml VA= RCHAR(20), CONSTRAINT U_NCKNXML_A_ID_XML UNIQUE (A_ID_xml, nickName_xml))} = [code=3D-542, state=3D42831] > at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:5= 56) > at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:4= 56) > Please wait... Show details =C2=BB > =C2=AB Hide details > org.ap= ache.openjpa.persistence.PersistenceException: DB2 SQL Error: SQLCODE=3D-54= 2, SQLSTATE=3D42831, SQLERRMC=3DNICKNAME_XML, DRIVER=3D3.50.152 {stmnt 6540= 5926 CREATE TABLE NickNames_xml (A_ID_xml INTEGER NOT NULL, nickName_xml VA= RCHAR(20), CONSTRAINT U_NCKNXML_A_ID_XML UNIQUE (A_ID_xml, nickName_xml))} = [code=3D-542, state=3D42831] > at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:5= 56) > at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:4= 56) > at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappin= gs(JDBCBrokerFactory.java:155) > at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappin= gs(JDBCBrokerFactory.java:159) > at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDB= CBrokerFactory.java:117) > at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(Abstract= BrokerFactory.java:199) > at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(Delega= tingBrokerFactory.java:156) > at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEnti= tyManager(EntityManagerFactoryImpl.java:213) > at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEnti= tyManager(EntityManagerFactoryImpl.java:151) > at org.apache.openjpa.persistence.test.SingleEMTestCase.setUp(SingleE= MTestCase.java:47) > at org.apache.openjpa.persistence.xml.TestSimpleXmlEntity.setUp(TestS= impleXmlEntity.java:28) > at junit.framework.TestCase.runBare(TestCase.java:125) > at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.ru= nBare(AbstractPersistenceTestCase.java:503) > at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.ru= nBare(AbstractPersistenceTestCase.java:479) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected(TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:118) > at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.ru= n(AbstractPersistenceTestCase.java:179) > at junit.framework.TestSuite.runTest(TestSuite.java:208) > at junit.framework.TestSuite.run(TestSuite.java:203) > at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc= cessorImpl.java:37) > at java.lang.reflect.Method.invoke(Method.java:600) > at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.= java:213) > at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute= TestSet(AbstractDirectoryTestSuite.java:140) > at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute= (AbstractDirectoryTestSuite.java:127) > at org.apache.maven.surefire.Surefire.run(Surefire.java:177) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorIm= pl.java:48) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc= cessorImpl.java:37) > at java.lang.reflect.Method.invoke(Method.java:600) > at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess= (SurefireBooter.java:345) > at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBoote= r.java:1009) > Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: DB2 SQL= Error: SQLCODE=3D-542, SQLSTATE=3D42831, SQLERRMC=3DNICKNAME_XML, DRIVER= =3D3.50.152 {stmnt 65405926 CREATE TABLE NickNames_xml (A_ID_xml INTEGER NO= T NULL, nickName_xml VARCHAR(20), CONSTRAINT U_NCKNXML_A_ID_XML UNIQUE (A_I= D_xml, nickName_xml))} [code=3D-542, state=3D42831] > at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(Loggin= gConnectionDecorator.java:257) > at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(Loggin= gConnectionDecorator.java:241) > at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$700(= LoggingConnectionDecorator.java:70) > at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConn= ection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:951) > at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(Dele= gatingStatement.java:136) > at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.ja= va:1200) > at org.apache.openjpa.jdbc.schema.SchemaTool.createTable(SchemaTool.j= ava:956) > at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:533) > at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:348) > at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:325) > at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:5= 04) > ... 33 more > The create table constraint requires nickName_xml be "NOT NULL" > Albert Lee --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.