I'm running Spring and Hibernate's implementation of JPA on Sun's GlassFish Enterprise Server with MySQL.
When I try to delete stuff from the database:
Query q = entityManager.createQuery("DELETE FROM SomeEntity e");
q.executeUpdate();
I get the error:
Caused by: java.sql.SQLException: Error in allocating a connection. Cause: java.lang.RuntimeException: Got exception during XAResource.start:
at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:115)
at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
at org.hibernate.jdbc.AbstractBatcher.openConnection(AbstractBatcher.java:550)
However, all other queries that invoke getResultList() works:
Query q = entityManager.createQuery("SELECT e FROM SomeEntity e");
q.getResultList();
For some reason the JDBC driver can't get a connect for executeUpdate()
yet it works for getResultList()
. The application's MySQL account has all privileges including INSERT and DELETE.