getSingleResult() - JPA TypedQuery's method
Method javax.persistence.TypedQuery
X getSingleResult()
Execute a SELECT query that returns a single result.
- Returns:
- the result
- Throws:
- NoResultException - if there is no result
- NonUniqueResultException - if more than one result
IllegalStateException
- if called for a Java Persistence query language UPDATE or DELETE statement- QueryTimeoutException - if the query execution exceeds the query timeout value set and only the statement is rolled back
- TransactionRequiredException - if a lock mode has been set and there is no transaction
- PessimisticLockException - if pessimistic locking fails and the transaction is rolled back
- LockTimeoutException - if pessimistic locking fails and only the statement is rolled back
- PersistenceException - if the query execution exceeds the query timeout value set and the transaction is rolled back
- NonUniqueResultException - if more than one result
- Since:
- JPA 2.0