openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ignacio Andreu" <plunch...@gmail.com>
Subject Re: Native DELETE on MySQL
Date Mon, 07 Apr 2008 10:37:49 GMT
I can't run a test right now, I've used JPQL bulk delete on MySQL using
OpenJPA (version 0.7). I wrote about it in my blog[1]. This evening, in my
time zone (Spain), I will try to investigate about this problem.

Regards,
- Ignacio

[1]
http://plunchete.wordpress.com/2007/05/30/jpql-and-how-to-delete-objects-in-jpa/

On Mon, Apr 7, 2008 at 12:21 PM, Ognjen Blagojevic <ognjen@etf.bg.ac.yu>
wrote:

>
> Yes, astersik was erroneous, but that wasn't the problem. Query:
>
>    Query q = em.createNativeQuery("DELETE FROM nastavnik");
>    result = q.executeUpdate();
>
> still throws the same exception ("Callable statements not supported.").
>
> And OPENJPA-459 stops me from using JPQL bulk delete on MySQL.
>
> Regards,
> Ognjen
>
>
>
> Ignacio Andreu wrote:
>
> > Hi,
> >
> > DELETE * FROM test is wrong, the SQL sould be: DELETE FROM test
> >
> > I don't know if this is your error but if you want to delete an object,
> > you
> > can use a JPQL sentence, something like:
> >
> > m.createQuery("delete from test t");
> >
> > Regards,
> >
> > - Ignacio
> >
> >
> > 2008/4/7 Ognjen Blagojevic <ognjen@etf.bg.ac.yu>:
> >
> >  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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message