openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Gauder <sebastian.gau...@denkwerk.com>
Subject Strange Exception during native UPDATE-query
Date Wed, 20 Aug 2008 13:17:41 GMT
Hey,

I'm getting a strange Exception when executing the follwing native query 
to a MySQL db:

            String statement = "UPDATE JBT_Order_Product " +
                         "SET product_id=100"+
                             " WHERE EXISTS " +
                                 "(SELECT o.id FROM JBT_Order o " +
                                     "WHERE o.scenario=0 " +
                                     "AND o.id = order_id)";
            Query query = em.createNativeQuery(statement);
            query.executeUpdate();

JBT_Order_Product is a Join-Table consisting of the two columns
product_id -> JBT_Product.id     and
order_id -> JBT_Order.id

Stacktrace:

<openjpa-1.2.0-r422266:683325 nonfatal general error> 
org.apache.openjpa.persistence.PersistenceException: PROCEDURE id does 
not exist
    at 
org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4238)
    at 
org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4203)
    at 
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:102)
    at 
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:88)
    at 
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:64)
    at 
org.apache.openjpa.jdbc.kernel.SQLStoreQuery$SQLExecutor.executeUpdate(SQLStoreQuery.java:237)
    at org.apache.openjpa.kernel.QueryImpl.update(QueryImpl.java:1039)
    at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:809)
    at org.apache.openjpa.kernel.QueryImpl.updateAll(QueryImpl.java:884)
    at org.apache.openjpa.kernel.QueryImpl.updateAll(QueryImpl.java:880)
    at 
org.apache.openjpa.kernel.DelegatingQuery.updateAll(DelegatingQuery.java:565)
    at 
org.apache.openjpa.persistence.QueryImpl.executeUpdate(QueryImpl.java:338)
    at com.denkwerk.jbt.elements.benchmarks.impl.A02a.perform(A02a.java:73)
    at 
com.denkwerk.jbt.server.AbstractBenchmarkBeanImpl.perform(AbstractBenchmarkBeanImpl.java:24)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at 
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
    at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at 
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
    at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy22.perform(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at 
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
    at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at 
org.springframework.remoting.support.RemoteInvocationTraceInterceptor.invoke(RemoteInvocationTraceInterceptor.java:70)
    at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy23.perform(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at 
org.springframework.remoting.support.RemoteInvocation.invoke(RemoteInvocation.java:205)
    at 
org.springframework.remoting.support.DefaultRemoteInvocationExecutor.invoke(DefaultRemoteInvocationExecutor.java:38)
    at 
org.springframework.remoting.support.RemoteInvocationBasedExporter.invoke(RemoteInvocationBasedExporter.java:78)
    at 
org.springframework.remoting.rmi.RmiBasedExporter.invoke(RmiBasedExporter.java:72)
    at 
org.springframework.remoting.rmi.RmiInvocationWrapper.invoke(RmiInvocationWrapper.java:72)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
    at sun.rmi.transport.Transport$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown 
Source)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown 
Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown 
Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLException: PROCEDURE id does not exist
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2975)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1600)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1695)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:3020)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2949)
    at com.mysql.jdbc.Statement.executeQuery(Statement.java:959)
    at 
com.mysql.jdbc.DatabaseMetaData.getCallStmtParameterTypes(DatabaseMetaData.java:1233)
    at 
com.mysql.jdbc.DatabaseMetaData.getProcedureColumns(DatabaseMetaData.java:3628)
    at 
com.mysql.jdbc.CallableStatement.determineParameterTypes(CallableStatement.java:628)
    at com.mysql.jdbc.CallableStatement.<init>(CallableStatement.java:513)
    at 
com.mysql.jdbc.Connection.parseCallableStatement(Connection.java:4147)
    at com.mysql.jdbc.Connection.prepareCall(Connection.java:4221)
    at com.mysql.jdbc.Connection.prepareCall(Connection.java:4195)
    at 
org.apache.commons.dbcp.DelegatingConnection.prepareCall(DelegatingConnection.java:275)
    at 
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareCall(PoolingDataSource.java:292)
    at 
org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareCall(DelegatingConnection.java:187)
    at 
org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareCall(DelegatingConnection.java:185)
    at 
org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareCall(DelegatingConnection.java:185)
    at 
org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareCall(DelegatingConnection.java:174)
    at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareCall(SQLBuffer.java:584)
    at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareCall(SQLBuffer.java:564)
    at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareCall(SQLBuffer.java:553)
    at 
org.apache.openjpa.jdbc.kernel.SQLStoreQuery$SQLExecutor.prepareCall(SQLStoreQuery.java:335)
    at 
org.apache.openjpa.jdbc.kernel.SQLStoreQuery$SQLExecutor.executeUpdate(SQLStoreQuery.java:227)
    ... 53 more



The term after PROCEDURE depends on  which column the SELECT-clause 
projects onto. So when I try "SELECT o.* FROM JBT_Order o", the 
Execption is "PROCEDURE * does not exist". Note, that this only happens 
with MySQL, Oracle or PostgreSQL perform fine.

Regards,
Seb

Mime
View raw message