executeUpdate « Query « JPA Q&A

1. Query.executeUpdate() results in XAResource exception    stackoverflow.com

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");
I get the ...

2. Query Timeouts not supported on executeUpdate()    forum.hibernate.org

We are using query timeout hints for both native and JPQL based queries using Hibernate as our JPA provider with great success. Timeouts work flawlessly with the Query.getSingleResult() and Query.getResultList() paths using Oracle as our DB implementation (in both JBOSS and WebSphere deployments using CMT) We have a number of queries that for performance purposes, perform an "insert into XYZ select ...

4. how to use Query.executeUpdate()?    forum.hibernate.org

5. query.executeUpdate() cannot resolve symbol    forum.hibernate.org

6. query.executeUpdate does not flush the session    forum.hibernate.org

I am facing issues with native sql insert statements. Persisting as objects works fine. This may be because Hibernate does not flush the session when it is absolutely necessary. It surfaces only when we mix native queries and objects. Consider 2 classes: public class A { @Id @GeneratedValue private Integer id; @MantToOne private B b; } public class B { @Id ...