Execute a SELECT query that returns a single untyped result.
- Returns:
- the result, or null if there is no result.
- Throws:
-
- if called for a Jakarta Persistence query language UPDATE or DELETE statement.IllegalStateException -
- if pessimistic locking fails and only the statement is rolled back.LockTimeoutException -
- if more than one result.NonUniqueResultException -
- if the query execution exceeds the query timeout value set and only the statement is rolled back.QueryTimeoutException -
- if pessimistic locking fails and the transaction is rolled back.PessimisticLockException -
- if the query execution exceeds the query timeout value set and the transaction is rolled back.PersistenceException -
- if a lock mode other thanTransactionRequiredExceptionNONEhas been set and there is no transaction or the persistence context has not been joined to the transaction.
- Since:
- Jakarta Persistence (JPA) 3.2