Community
Participate
Working Groups
Weblogic 10 seems to wrap blob in its own object, which causes ClassCastException when it is tried to be cast to oracle.sql.BLOB (wrapper class is weblogic.jdbc.wrapper.Blob_oracle_sql_BLOB). Not sure how to fix it, but it seems there is no need to cast it to Oracle specific type, just using java.sql.Blob should be enough. Weblogic 10 MP1, Oracle 10. Stack trace follows: Caused by: javax.persistence.RollbackException: java.lang.ClassCastException: weblogic.jdbc.wrapper.Blob_oracle_sql_BLOB at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:102) at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:63) Caused by: java.lang.ClassCastException: weblogic.jdbc.wrapper.Blob_oracle_sql_BLOB at org.eclipse.persistence.platform.database.oracle.Oracle8Platform.writeLOB(Oracle8Platform.java:158) at org.eclipse.persistence.internal.helper.LOBValueWriter.fetchLocatorAndWriteValue(LOBValueWriter.java:86) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:597) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:500) at org.eclipse.persistence.internal.helper.LOBValueWriter.buildAndExecuteCall(LOBValueWriter.java:71) at org.eclipse.persistence.internal.helper.LOBValueWriter.buildAndExecuteSelectCalls(LOBValueWriter.java:182) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.flushSelectCalls(DatabaseAccessor.java:134) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:345) at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:163) at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:178) at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:465) at org.eclipse.persistence.queries.InsertObjectQuery.executeCommit(InsertObjectQuery.java:80) at org.eclipse.persistence.queries.InsertObjectQuery.executeCommitWithChangeSet(InsertObjectQuery.java:90) at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:290) at org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58) at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:666) at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:585) at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:114) at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:86) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2587) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1178) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1162) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1108) at org.eclipse.persistence.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:254) at org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsForClassWithChangeSet(CommitManager.java:229) at org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:185) at org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:3129) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1241) at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:478) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1330) at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:159) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:1002) at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:84) ... 43 common frames omitted
This should work when setting the eclipselink.target-server (see http://forums.oracle.com/forums/thread.jspa?threadID=712370). However, I think the a better alternative could be to replace oracle specific type with java.sql.Blob.
Changing to enhancement because this bug appears to indicate that the functionality works with the correct server platform. The request is to make the behavior even easier to use.
Created attachment 124255 [details] Simple patch to fix the ClassCastException Attached a simple patch to fix the ClassCastException (tested with Weblogic 10 and Oracle 10). Would there be any chance to get it applied hopefully even for 1.1? Both oracle.sql.BLOB and the the proxy returned by Weblogic implements java.sql.Blob, so there fix should be safe.
For reference, related bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=215254
Investigating. It looks like this fix will need to go in Oracle10Platform instead. Previous versions of the JDBC driver did not support the necessary syntax.
Created attachment 139554 [details] Proposed updates to submitted patch
Fix updates Oracle10Platform to use JDBC 3.0 API for LOBs Tested by running full Core LRG Reviewed by Tom Ware (reviewed user-submitted fix) with help from Peter Krogh
Mass update to change fixed in target.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink