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 Re: Native DELETE on MySQL
Date Tue, 08 Apr 2008 08:05:09 GMT
Hi Michael,

Yes, I tried both 5.0.4 and 5.1.6, but they throw the same exception. 
Both with native queries, and JPQL.


Regards,
Ognjen


Michael Dick wrote:
> Hi Ognjen,
> 
> Have you tried running with the latest jdbc driver from MySQL? I downloaded
> version 5.1.6 and it looks like it's working now.
> 
> I originally tried using v5.0.5, and I got a similar exception :
> 
> <openjpa-1.0.3-SNAPSHOT-r420667:640493M nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: Unable to retrieve
> metadata for procedure.
>     at
> org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:3951)
>     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:242)
>    <snip>
> Caused by: java.sql.SQLException: Unable to retrieve metadata for procedure.
>     at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
>     at
> com.mysql.jdbc.CallableStatement.extractProcedureName(CallableStatement.java:857)
>     at
> com.mysql.jdbc.CallableStatement.determineParameterTypes(CallableStatement.java:692)
>     at com.mysql.jdbc.CallableStatement.<init>(CallableStatement.java:513)
>     at
> com.mysql.jdbc.Connection.parseCallableStatement(Connection.java:4520)
>     at com.mysql.jdbc.Connection.prepareCall(Connection.java:4594)
>     at com.mysql.jdbc.Connection.prepareCall(Connection.java:4568)
>     at
> org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareCall(DelegatingConnection.java:185)
>     <snip>
> 
> Hope this helps,
> 
> -Mike
> 
> On Mon, Apr 7, 2008 at 12:12 PM, Ignacio Andreu <plunchete@gmail.com> wrote:
> 
>> Hi Ognjen,
>>
>> If you don't use an alias the bulk delete works ok, I tested it with the
>> SupportsSubselect=true and I didn't have any problem. I used this code:
>>
>> Query q = em.createQuery("delete from Test");
>> q.executeUpdate();
>>
>>
>> Regards,
>>
>> - Ignacio
>>
>>
>> On Mon, Apr 7, 2008 at 12:56 PM, Ognjen Blagojevic <ognjen@etf.bg.ac.yu>
>> wrote:
>>
>>> Ok, thanks.
>>>
>>> OPENJPA-459 is problematic only if parameter SupportsSubselect is set
>>> (which is my case).
>>>
>>> BTW, we are in the same time zone - CEST. :)
>>>
>>>
>>> Regards,
>>> Ognjen
>>>
>>>
>>> Ignacio Andreu wrote:
>>>
>>>> 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
View raw message