MySQL 4.1.22 with database/schema DB2ADMIN (don't ask!) MySQL JDBC connector 5.1.12 OpenJPA-1.2.1
I have a simple native query:
EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); Query create = em.createNativeQuery("create table DB2ADMIN.PARENT (a int)"); create.executeUpdate(); em.getTransaction().commit();
The exception (callable statements not supported) is pasted below. This happens for any native query, not just one with a delete statement.
The nativequery works fine with OpenJPA-2.0.0-beta with the same MySQL db and the same MySQL driver. Additionally, DB2 + OpenJPA-1.2.1 also works fine. So it's a combination of MySQL JDBC connector 5.1.12 + OpenJPA 1.2.1 that is behaving strangely.
If I run a separate Java program that creates its own JDBC connection using the same MySQL driver, the CREATE TABLE and subsequent DELETE FROM statement work fine. So it's not a driver problem.
Any suggestions on how to get the native query working ?
(Aside: I saw a similar nativequery+delete issue [1] that resulted in OPENJPA-459. It has been fixed in trunk, and I tested that it works fine with the MySQL 5.1.12 driver. Unfortunately, I am in a production environment and cannot move to that release. I backported OPENJPA-459 (commit 835257) from trunk to OpenJPA-1.2.1 in my local workspace, but that did not fix the nativequery problem, so something else fixed it in trunk. OPENJPA-459 is probably not even related to this problem.)