You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Albert Lee (JIRA)" <ji...@apache.org> on 2010/10/17 03:09:22 UTC

[jira] Commented: (OPENJPA-1839) TestXMLCustomerOrder failed against Oracle with "ORA-01461: can bind a LONG value only for insert into a LONG column"

    [ https://issues.apache.org/jira/browse/OPENJPA-1839?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12921779#action_12921779 ] 

Albert Lee commented on OPENJPA-1839:
-------------------------------------

OpenJPA 

"CREATE TABLE TORDERXML (oid NUMBER NOT NULL, amount NUMBER, delivered NUMBER, shipAddress XMLType, version NUMBER, CUSTOMER_COUNTRYCODE VARCHAR2(255), CUSTOMER_ID NUMBER, PRIMARY KEY (oid))"

and 

"INSERT INTO TORDERXML (oid, amount, delivered, shipAddress, version, CUSTOMER_COUNTRYCODE, CUSTOMER_ID) VALUES (?, ?, ?, XMLType(?), ?, ?, ?) [params=(int) 10, (double) 850.0, (int) 0, (Reader) java.io.StringReader@61ea61ea, (int) 1, (String) USA, (int) 1]"

After looking a little more, the ORA-01461 is very misleading. The cause of the problem is the XMLTYPE(?) is set with setCharacterStream( 4, new StringReader( shippingAddrStr ), shippingAddrStr.length ) and if the length of shippingAddrStr is > 4000 characters, it will result with this exception.

> TestXMLCustomerOrder failed against Oracle with "ORA-01461: can bind a LONG value only for insert into a LONG column"
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1839
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1839
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.0.0, 2.0.1
>            Reporter: Albert Lee
>            Assignee: Albert Lee
>
> A few junit tests failed with exception similar to the following stack.
> 30500  test  TRACE  [main] openjpa.Runtime - An exception occurred while ending the transaction.  This exception will be re-thrown.
> <openjpa-2.1.0-SNAPSHOT-r422266:1022129 fatal store error> org.apache.openjpa.util.StoreException: The transaction has been rolled back.  See the nested exceptions for details on the errors that occurred.
> FailedObject: org.apache.openjpa.persistence.xmlmapping.entities.Order@16c616c6
> 	at org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2311)
> 	at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2149)
> 	at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2046)
> 	at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1964)
> 	at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81)
> 	at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1488)
> 	at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:925)
> 	at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:560)
> 	at org.apache.openjpa.persistence.xmlmapping.query.TestXMLCustomerOrder.setUp(TestXMLCustomerOrder.java:86)
> 	at junit.framework.TestCase.runBare(TestCase.java:125)
> 	at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(AbstractPersistenceTestCase.java:562)
> 	at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(AbstractPersistenceTestCase.java:538)
> 	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.run(AbstractPersistenceTestCase.java:206)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	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: <openjpa-2.1.0-SNAPSHOT-r422266:1022129 fatal store error> org.apache.openjpa.util.LockException: Unable to obtain an object lock on "org.apache.openjpa.persistence.xmlmapping.entities.Order@16c616c6".
> FailedObject: org.apache.openjpa.persistence.xmlmapping.entities.Order@16c616c6
> 	at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4851)
> 	at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4829)
> 	at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:137)
> 	at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:78)
> 	at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushBatch(BatchingPreparedStatementManagerImpl.java:217)
> 	at org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager.flush(BatchingConstraintUpdateManager.java:63)
> 	at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:103)
> 	at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:76)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:738)
> 	at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:131)
> 	... 24 more
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
>  {prepstmnt 1578655256 INSERT INTO TORDERXML (oid, amount, delivered, shipAddress, version, CUSTOMER_COUNTRYCODE, CUSTOMER_ID) VALUES (?, ?, ?, XMLType(?), ?, ?, ?) [params=?, ?, ?, ?, ?, ?, ?]} [code=1461, state=72000]
> 	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:274)
> 	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:262)
> 	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$5(LoggingConnectionDecorator.java:261)
> 	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeBatch(LoggingConnectionDecorator.java:1273)
> 	at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeBatch(DelegatingPreparedStatement.java:263)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeBatch(JDBCStoreManager.java:1790)
> 	at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.executeBatch(BatchingPreparedStatementManagerImpl.java:356)
> 	at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushBatch(BatchingPreparedStatementManagerImpl.java:187)
> 	... 29 more

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