diff --git a/jOOQ/src/main/java/org/jooq/FactoryOperations.java b/jOOQ/src/main/java/org/jooq/FactoryOperations.java index 358d405c75..b9348e3a03 100644 --- a/jOOQ/src/main/java/org/jooq/FactoryOperations.java +++ b/jOOQ/src/main/java/org/jooq/FactoryOperations.java @@ -63,6 +63,7 @@ import javax.sql.DataSource; import org.jooq.conf.Settings; import org.jooq.conf.StatementType; import org.jooq.exception.DataAccessException; +import org.jooq.exception.InvalidResultException; import org.jooq.exception.MappingException; import org.jooq.impl.Factory; @@ -1027,6 +1028,7 @@ public interface FactoryOperations extends Configuration { * * @return The record or null if no record was returned * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the query returned more than one record */ @Support R fetchOne(Table table) throws DataAccessException; @@ -1041,6 +1043,7 @@ public interface FactoryOperations extends Configuration { * * @return The record or null if no record was returned * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the query returned more than one record */ @Support R fetchOne(Table table, Condition condition) throws DataAccessException; @@ -1489,6 +1492,7 @@ public interface FactoryOperations extends Configuration { * null, even if the database returns no * {@link ResultSet} * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the query returned more than one record */ @Support Record fetchOne(String sql) throws DataAccessException; @@ -1516,6 +1520,7 @@ public interface FactoryOperations extends Configuration { * @return The results from the executed query. This may be * null if the database returned no records * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the query returned more than one record */ @Support Record fetchOne(String sql, Object... bindings) throws DataAccessException; @@ -1547,6 +1552,7 @@ public interface FactoryOperations extends Configuration { * @return The results from the executed query. This may be * null if the database returned no records * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the query returned more than one record */ @Support Record fetchOne(String sql, QueryPart... parts) throws DataAccessException; diff --git a/jOOQ/src/main/java/org/jooq/ResultQuery.java b/jOOQ/src/main/java/org/jooq/ResultQuery.java index fac547fbb1..7df6ba8537 100644 --- a/jOOQ/src/main/java/org/jooq/ResultQuery.java +++ b/jOOQ/src/main/java/org/jooq/ResultQuery.java @@ -46,6 +46,7 @@ import java.util.concurrent.ExecutorService; import org.jooq.conf.Settings; import org.jooq.exception.DataAccessException; import org.jooq.exception.DataTypeException; +import org.jooq.exception.InvalidResultException; import org.jooq.exception.MappingException; /** @@ -286,11 +287,8 @@ public interface ResultQuery extends Query { * * @return The resulting value or null if the query returned no * records. - * @throws DataAccessException This exception is thrown - *
    - *
  • if something went wrong executing the query
  • if - * the query returned more than one value
  • - *
+ * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the query returned more than one record */ T fetchOne(Field field) throws DataAccessException; @@ -303,11 +301,8 @@ public interface ResultQuery extends Query { * * @return The resulting value or null if the query returned no * records. - * @throws DataAccessException This exception is thrown - *
    - *
  • if something went wrong executing the query
  • if - * the query returned more than one value
  • - *
+ * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the query returned more than one record */ T fetchOne(Field field, Class type) throws DataAccessException; @@ -320,11 +315,8 @@ public interface ResultQuery extends Query { * * @return The resulting value or null if the query returned no * records. - * @throws DataAccessException This exception is thrown - *
    - *
  • if something went wrong executing the query
  • if - * the query returned more than one value
  • - *
+ * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the query returned more than one record */ U fetchOne(Field field, Converter converter) throws DataAccessException; @@ -337,11 +329,8 @@ public interface ResultQuery extends Query { * * @return The resulting value or null if the query returned no * records. - * @throws DataAccessException This exception is thrown - *
    - *
  • if something went wrong executing the query
  • if - * the query returned more than one value
  • - *
+ * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the query returned more than one record */ Object fetchOne(int fieldIndex) throws DataAccessException; @@ -354,11 +343,8 @@ public interface ResultQuery extends Query { * * @return The resulting value or null if the query returned no * records. - * @throws DataAccessException This exception is thrown - *
    - *
  • if something went wrong executing the query
  • if - * the query returned more than one value
  • - *
+ * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the query returned more than one record */ T fetchOne(int fieldIndex, Class type) throws DataAccessException; @@ -371,11 +357,8 @@ public interface ResultQuery extends Query { * * @return The resulting value or null if the query returned no * records. - * @throws DataAccessException This exception is thrown - *
    - *
  • if something went wrong executing the query
  • if - * the query returned more than one value
  • - *
+ * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the query returned more than one record */ U fetchOne(int fieldIndex, Converter converter) throws DataAccessException; @@ -388,11 +371,8 @@ public interface ResultQuery extends Query { * * @return The resulting value or null if the query returned no * records. - * @throws DataAccessException This exception is thrown - *
    - *
  • if something went wrong executing the query
  • if - * the query returned more than one value
  • - *
+ * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the query returned more than one record */ Object fetchOne(String fieldName) throws DataAccessException; @@ -405,11 +385,8 @@ public interface ResultQuery extends Query { * * @return The resulting value or null if the query returned no * records. - * @throws DataAccessException This exception is thrown - *
    - *
  • if something went wrong executing the query
  • if - * the query returned more than one value
  • - *
+ * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the query returned more than one record */ T fetchOne(String fieldName, Class type) throws DataAccessException; @@ -422,11 +399,8 @@ public interface ResultQuery extends Query { * * @return The resulting value or null if the query returned no * records. - * @throws DataAccessException This exception is thrown - *
    - *
  • if something went wrong executing the query
  • if - * the query returned more than one value
  • - *
+ * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the query returned more than one record */ U fetchOne(String fieldName, Converter converter) throws DataAccessException; @@ -439,11 +413,8 @@ public interface ResultQuery extends Query { * * @return The resulting record or null if the query returns no * records. - * @throws DataAccessException This exception is thrown - *
    - *
  • if something went wrong executing the query
  • if - * the query returned more than one record
  • - *
+ * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the query returned more than one record */ R fetchOne() throws DataAccessException; @@ -465,11 +436,9 @@ public interface ResultQuery extends Query { * maps. * * @return The result. - * @throws DataAccessException This exception is thrown - *
    - *
  • if something went wrong executing the query
  • - *
  • if several fields share the same name
  • - *
+ * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the key field returned two or more + * equal values from the result set. */ List> fetchMaps() throws DataAccessException; @@ -479,12 +448,8 @@ public interface ResultQuery extends Query { * * @return The resulting record or null if the query returns no * records. - * @throws DataAccessException This exception is thrown - *
    - *
  • if something went wrong executing the query
  • - *
  • if the query returned more than one record
  • - *
  • if several fields share the same name
  • - *
+ * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the query returned more than one record */ Map fetchOneMap() throws DataAccessException; @@ -503,12 +468,9 @@ public interface ResultQuery extends Query { * @param key The key field. Client code must assure that this field is * unique in the result set. * @return A Map containing the results - * @throws DataAccessException This exception is thrown - *
    - *
  • if something went wrong executing the query
  • if - * the key field returned two or more equal values from the - * result set.
  • - *
+ * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the key field returned two or more + * equal values from the result set. */ Map fetchMap(Field key) throws DataAccessException; @@ -525,12 +487,9 @@ public interface ResultQuery extends Query { * unique in the result set. * @param value The value field * @return A Map containing the results - * @throws DataAccessException This exception is thrown - *
    - *
  • if something went wrong executing the query
  • if - * the key field returned two or more equal values from the - * result set.
  • - *
+ * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the key field returned two or more + * equal values from the result set. */ Map fetchMap(Field key, Field value) throws DataAccessException; @@ -659,11 +618,8 @@ public interface ResultQuery extends Query { * * @return The resulting record or null if the query returns no * records. - * @throws DataAccessException This exception is thrown - *
    - *
  • if something went wrong executing the query
  • if - * the query returned more than one record
  • - *
+ * @throws DataAccessException if something went wrong executing the query + * @throws InvalidResultException if the query returned more than one record */ Object[] fetchOneArray() throws DataAccessException;