views:

87

answers:

2

I'm using JPA 1.0 with hibernate as my provider. Inside an entitymanager transaction, if a series of native queries are run (which include DELETE sql statements) and an error occurs, will the native queries rollback too on the error?

I ran into a deadlock problem in an oracle database and I noticed that it left the database inconsistent even though some of the transaction was rolled back. I'm wondering if the inconsistency resulted from the fact that one transaction succeeded but the other transaction rolled back but only up to a certain point?

Thanks..

+1  A: 

A rollback doesn't rollback "JPQL queries" specifically, it rollbacks SQL statements and this includes SQL statements from "native queries".

Pascal Thivent
Thanks. I'll write a few tests cases and see. That were my initial thoughts as well..
niran
A: 

Yes. The JPQL and native SQL queries are rolled back when an error occurs.

nanda