- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.jooq.exception.DataAccessException
-
- org.jooq.exception.InvalidResultException
-
- org.jooq.exception.TooManyRowsException
-
- All Implemented Interfaces:
Serializable
public class TooManyRowsException extends InvalidResultException
Too many rows (more than 1) were returned from aResultQuery
.Like any other
InvalidResultException
, this exception indicates to clients that the result was not what they expected, but this does not have any effect on the outcome of the statement producing that result. For instance, if callingResultQuery.fetchOne()
on aSELECT .. FOR UPDATE
query, orInsertResultStep.fetchOne()
on anINSERT
statement, the database change will still be executed: the rows will still be locked or inserted.Performance
Methods throwing
TooManyRowsException
need to retrieve at most two records from the underlying JDBCResultSet
, which, depending on theStatement.getFetchSize()
/ResultQuery.fetchSize(int)
, might incur additional database roundtrips. If this causes problems,ResultQuery.fetchAny()
may be preferred.- Author:
- Lukas Eder
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TooManyRowsException()
Constructor for TooManyRowsException.TooManyRowsException(String message)
Constructor for TooManyRowsException.
-
Method Summary
-
Methods inherited from class org.jooq.exception.DataAccessException
getCause, getStackTrace, sqlState, sqlStateClass, sqlStateSubclass
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
TooManyRowsException
public TooManyRowsException()
Constructor for TooManyRowsException.
-
TooManyRowsException
public TooManyRowsException(String message)
Constructor for TooManyRowsException.- Parameters:
message
- the detail message
-
-