diff --git a/source/java/org/alfresco/repo/domain/query/CannedQueryDAO.java b/source/java/org/alfresco/repo/domain/query/CannedQueryDAO.java index 988e41359b..5acf8f037b 100644 --- a/source/java/org/alfresco/repo/domain/query/CannedQueryDAO.java +++ b/source/java/org/alfresco/repo/domain/query/CannedQueryDAO.java @@ -72,7 +72,8 @@ public interface CannedQueryDAO * @param queryName the name of the query e.g. select_userCount * @param parameterObj the values to drive the selection (may be null if not required) * @param offset the number of results to skip - * @param limit the maximum number of results to retrieve + * @param limit the maximum number of results to retrieve or Integer.MAX_VALUE + * for no limit * @return the list of results */ List executeQuery( @@ -87,7 +88,8 @@ public interface CannedQueryDAO * @param queryName the name of the query e.g. select_userCount * @param parameterObj the values to drive the selection (may be null if not required) * @param offset the number of results to skip - * @param limit the maximum number of results to retrieve + * @param limit the maximum number of results to retrieve or Integer.MAX_VALUE + * for no limit * @return the list of results */ void executeQuery( diff --git a/source/java/org/alfresco/repo/domain/query/CannedQueryDAOTest.java b/source/java/org/alfresco/repo/domain/query/CannedQueryDAOTest.java index 994e1a68e8..cdc8b74b42 100644 --- a/source/java/org/alfresco/repo/domain/query/CannedQueryDAOTest.java +++ b/source/java/org/alfresco/repo/domain/query/CannedQueryDAOTest.java @@ -233,15 +233,16 @@ public class CannedQueryDAOTest extends TestCase { // Expected } - try - { - cannedQueryDAO.executeQuery(QUERY_NS, QUERY_SELECT_MIMETYPES, null, 0, Integer.MAX_VALUE); - fail("Illegal parameter not detected"); - } - catch (IllegalArgumentException e) - { - // Expected - } +// TODO MyBatis workaround - temporarily support unlimited for nested result maps (see also below) +// try +// { +// cannedQueryDAO.executeQuery(QUERY_NS, QUERY_SELECT_MIMETYPES, null, 0, Integer.MAX_VALUE); +// fail("Illegal parameter not detected"); +// } +// catch (IllegalArgumentException e) +// { +// // Expected +// } } public void testExecute_ListMimetypes() throws Throwable diff --git a/source/java/org/alfresco/repo/domain/query/ibatis/CannedQueryDAOImpl.java b/source/java/org/alfresco/repo/domain/query/ibatis/CannedQueryDAOImpl.java index 4f56f26a96..9b4b24926e 100644 --- a/source/java/org/alfresco/repo/domain/query/ibatis/CannedQueryDAOImpl.java +++ b/source/java/org/alfresco/repo/domain/query/ibatis/CannedQueryDAOImpl.java @@ -131,21 +131,16 @@ public class CannedQueryDAOImpl extends AbstractCannedQueryDAOImpl throw new IllegalArgumentException("Query result offset must be zero or greater."); } - // TODO MyBatis workaround - temporarily support unlimited for nested result maps (see also below) - /* - if (limit <= 0 || limit == Integer.MAX_VALUE) + if (limit <= 0) { - throw new IllegalArgumentException("Query results must be constrained by a limit."); + throw new IllegalArgumentException("Query results limit must be greater than zero."); } - */ String query = makeQueryName(sqlNamespace, queryName); try { if ((offset == 0) && (limit == Integer.MAX_VALUE)) { - // TODO MyBatis workaround - temporarily support unlimited for nested result maps (see also above) - // http://code.google.com/p/mybatis/issues/detail?id=129 return (List) template.selectList(query, parameterObj); } else @@ -182,13 +177,10 @@ public class CannedQueryDAOImpl extends AbstractCannedQueryDAOImpl throw new IllegalArgumentException("Query result offset must be zero or greater."); } - // TODO MyBatis workaround - temporarily support unlimited for nested result maps (see also below) - /* - if (limit <= 0 || limit == Integer.MAX_VALUE) + if (limit <= 0) { - throw new IllegalArgumentException("Query results must be constrained by a limit."); + throw new IllegalArgumentException("Query results limit must be greater than zero."); } - */ String query = makeQueryName(sqlNamespace, queryName); ResultHandlerTranslator resultHandler = new ResultHandlerTranslator(handler); @@ -200,8 +192,6 @@ public class CannedQueryDAOImpl extends AbstractCannedQueryDAOImpl if ((offset == 0) && (limit == Integer.MAX_VALUE)) { - // TODO MyBatis workaround - temporarily support unlimited for nested result maps (see also above) - // http://code.google.com/p/mybatis/issues/detail?id=129 template.select(query, parameterObj, resultHandler); } else