This subsection describes the notes on executing a query.
- In the setMaxResults method or setFirstResult method, if a query in which collection contains FETCH JOIN is executed, the results might be incorrect.
- The Query methods other than the executeUpdate method need not be executed in a transaction. Particularly, the getResultList and getSingleResult methods need not be executed in a transaction.
- When the query is executed with EntityManager of the transaction scope persistence context, the resulting entity has the detached state. When the query is executed with EntityManager of the extended persistence context, all the entities have the managed state.
- The runtime exceptions other than NoResultException and NonUniqueResultException thrown from the Query interface methods roll back the current transaction.