openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ognjen Blagojevic <ogn...@etf.bg.ac.yu>
Subject Native DELETE on MySQL
Date Mon, 07 Apr 2008 08:37:21 GMT
Hi OpenJPA developers,

When I try to execute bulk delete using native queries on MySQL, this 
piece of code:

     em.getTransaction().begin();
     try {
         Query q = em.createNativeQuery("DELETE * FROM test");
         result = q.executeUpdate();
         em.getTransaction().commit();
     } catch (Exception e) {
         em.getTransaction().rollback();
     }


seems to throw an exception "Callable statements not supported." (stack 
trace below). Does anyone know why?

Regards,
Ognjen

----------------------

16  eUniversityPu  INFO   [main] openjpa.Runtime - Starting OpenJPA 1.0.2
282  eUniversityPu  INFO   [main] openjpa.jdbc.JDBC - Using dictionary 
class "org.apache.openjpa.jdbc.sql.MySQLDictionary" (MySQL 4.1.16 
,MySQL-AB JDBC Driver mysql-connector-java-5.0.4 ( $Date: 2006-10-19 
17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )).
<openjpa-1.0.2-r420667:627158 nonfatal general error> 
org.apache.openjpa.persistence.PersistenceException: Callable statements 
not supported.
	at 
org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:3946)
	at 
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:97)
	at 
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:83)
	at 
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:59)
	at 
org.apache.openjpa.jdbc.kernel.SQLStoreQuery$SQLExecutor.executeUpdate(SQLStoreQuery.java:245)
	at org.apache.openjpa.kernel.QueryImpl.update(QueryImpl.java:1039)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:803)
	at org.apache.openjpa.kernel.QueryImpl.updateAll(QueryImpl.java:878)
	at org.apache.openjpa.kernel.QueryImpl.updateAll(QueryImpl.java:874)
	at 
org.apache.openjpa.kernel.DelegatingQuery.updateAll(DelegatingQuery.java:565)
	at 
org.apache.openjpa.persistence.QueryImpl.executeUpdate(QueryImpl.java:322)
	at 
yu.ac.bg.rcub.soleil.session.Glavni.customNativeDeleteTest(Glavni.java:657)
	at yu.ac.bg.rcub.soleil.session.QueryTest.main(QueryTest.java:29)
Caused by: java.sql.SQLException: Callable statements not supported.
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
	at com.mysql.jdbc.Connection.prepareCall(Connection.java:4522)
	at com.mysql.jdbc.Connection.prepareCall(Connection.java:4470)
	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:185)
	at 
org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareCall(DelegatingConnection.java:183)
	at 
org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareCall(DelegatingConnection.java:172)
	at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareCall(SQLBuffer.java:534)
	at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareCall(SQLBuffer.java:514)
	at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareCall(SQLBuffer.java:503)
	at 
org.apache.openjpa.jdbc.kernel.SQLStoreQuery$SQLExecutor.executeUpdate(SQLStoreQuery.java:226)
	... 8 more
<openjpa-1.0.2-r420667:627158 nonfatal general error> 
org.apache.openjpa.persistence.PersistenceException: Callable statements 
not supported.
	at 
org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:3946)
	at 
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:97)
	at 
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:83)
	at 
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:59)
	at 
org.apache.openjpa.jdbc.kernel.SQLStoreQuery$SQLExecutor.executeUpdate(SQLStoreQuery.java:245)
	at org.apache.openjpa.kernel.QueryImpl.update(QueryImpl.java:1039)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:803)
	at org.apache.openjpa.kernel.QueryImpl.updateAll(QueryImpl.java:878)
	at org.apache.openjpa.kernel.QueryImpl.updateAll(QueryImpl.java:874)
	at 
org.apache.openjpa.kernel.DelegatingQuery.updateAll(DelegatingQuery.java:565)
	at 
org.apache.openjpa.persistence.QueryImpl.executeUpdate(QueryImpl.java:322)
	at yu.ac.bg.rcub.soleil.session.Glavni.customNativeDelete(Glavni.java:641)
	at yu.ac.bg.rcub.soleil.session.QueryTest.main(QueryTest.java:33)
Caused by: java.sql.SQLException: Callable statements not supported.
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
	at com.mysql.jdbc.Connection.prepareCall(Connection.java:4522)
	at com.mysql.jdbc.Connection.prepareCall(Connection.java:4470)
	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:185)
	at 
org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareCall(DelegatingConnection.java:183)
	at 
org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareCall(DelegatingConnection.java:172)
	at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareCall(SQLBuffer.java:534)
	at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareCall(SQLBuffer.java:514)
	at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareCall(SQLBuffer.java:503)
	at 
org.apache.openjpa.jdbc.kernel.SQLStoreQuery$SQLExecutor.executeUpdate(SQLStoreQuery.java:226)
	... 8 more

Mime
View raw message