Index: archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/AbstractDeclarativeConstraint.java
===================================================================
--- archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/AbstractDeclarativeConstraint.java	(revision 558600)
+++ archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/AbstractDeclarativeConstraint.java	(working copy)
@@ -39,6 +39,8 @@
 
     protected Object[] params;
 
+    protected int[] range;
+
     public String getFilter()
     {
         return null;
@@ -73,4 +75,9 @@
     {
         return variables;
     }
+
+    public int[] getRange()
+    {
+    	return range;
+    }
 }
Index: archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RangeConstraint.java
===================================================================
--- archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RangeConstraint.java	(revision 0)
+++ archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RangeConstraint.java	(revision 0)
@@ -0,0 +1,45 @@
+package org.apache.maven.archiva.database.constraints;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.database.Constraint;
+
+/**
+ * RangeConstraint 
+ */
+public class RangeConstraint
+    extends AbstractDeclarativeConstraint
+    implements Constraint
+{
+    public RangeConstraint( int[] range )
+    {
+    	this.range = range;
+    }
+
+    public String getSortColumn()
+    {
+        return null;
+    }
+
+    public String getWhereCondition()
+    {
+        return null;
+    }
+}

Property changes on: archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RangeConstraint.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByArtifactIdConstraint.java
===================================================================
--- archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByArtifactIdConstraint.java	(revision 0)
+++ archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByArtifactIdConstraint.java	(revision 0)
@@ -0,0 +1,48 @@
+package org.apache.maven.archiva.database.constraints;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.database.Constraint;
+
+/**
+ * RepositoryProblemByArtifactIdConstraint
+ */
+public class RepositoryProblemByArtifactIdConstraint extends RangeConstraint implements Constraint
+{
+    private String whereClause;
+
+    public RepositoryProblemByArtifactIdConstraint( int[] range, String desiredArtifactId )
+    {
+        super( range );
+        whereClause = "artifactId == desiredArtifactId";
+        declParams = new String[] { "String desiredArtifactId" };
+        params = new Object[] { desiredArtifactId };
+    }
+
+    public String getSortColumn()
+    {
+        return "groupId";
+    }
+
+    public String getWhereCondition()
+    {
+        return whereClause;
+    }
+}

Property changes on: archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByArtifactIdConstraint.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByGroupIdConstraint.java
===================================================================
--- archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByGroupIdConstraint.java	(revision 0)
+++ archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByGroupIdConstraint.java	(revision 0)
@@ -0,0 +1,48 @@
+package org.apache.maven.archiva.database.constraints;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.database.Constraint;
+
+/**
+ * RepositoryProblemByGroupIdConstraint
+ */
+public class RepositoryProblemByGroupIdConstraint extends RangeConstraint implements Constraint
+{
+    private String whereClause;
+
+    public RepositoryProblemByGroupIdConstraint( int[] range, String desiredGroupId )
+    {
+        super( range );
+        whereClause = "groupId == desiredGroupId";
+        declParams = new String[] { "String desiredGroupId" };
+        params = new Object[] { desiredGroupId };
+    }
+
+    public String getSortColumn()
+    {
+        return "artifactId";
+    }
+
+    public String getWhereCondition()
+    {
+        return whereClause;
+    }
+}

Property changes on: archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByGroupIdConstraint.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByRepositoryIdConstraint.java
===================================================================
--- archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByRepositoryIdConstraint.java	(revision 0)
+++ archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByRepositoryIdConstraint.java	(revision 0)
@@ -0,0 +1,48 @@
+package org.apache.maven.archiva.database.constraints;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.database.Constraint;
+
+/**
+ * RepositoryProblemByRepositoryIdConstraint
+ */
+public class RepositoryProblemByRepositoryIdConstraint extends RangeConstraint implements Constraint
+{
+    private String whereClause;
+
+    public RepositoryProblemByRepositoryIdConstraint( int[] range, String desiredRepositoryId )
+    {
+        super( range );
+        whereClause = "repositoryId == desiredRepositoryId";
+        declParams = new String[] { "String desiredRepositoryId" };
+        params = new Object[] { desiredRepositoryId };
+    }
+
+    public String getSortColumn()
+    {
+        return "groupId";
+    }
+
+    public String getWhereCondition()
+    {
+        return whereClause;
+    }
+}

Property changes on: archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByRepositoryIdConstraint.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: archiva-database/src/main/java/org/apache/maven/archiva/database/DeclarativeConstraint.java
===================================================================
--- archiva-database/src/main/java/org/apache/maven/archiva/database/DeclarativeConstraint.java	(revision 558600)
+++ archiva-database/src/main/java/org/apache/maven/archiva/database/DeclarativeConstraint.java	(working copy)
@@ -92,4 +92,13 @@
      * @return the equivalent of the SELECT WHERE (condition) value for this constraint. (can be null)
      */
     public abstract String getWhereCondition();
+
+    /**
+     * Get the declared range used for this query. (optional)
+     * 
+     * NOTE: This is DAO implementation specific.
+     * 
+     * @return the range. (can be null)
+     */
+    public abstract int[] getRange();
 }
\ No newline at end of file
Index: archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java
===================================================================
--- archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java	(revision 558600)
+++ archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java	(working copy)
@@ -357,6 +357,11 @@
             query.declareImports( StringUtils.join( constraint.getDeclaredImports(), ", " ) );
         }
 
+        if ( constraint.getRange() != null )
+        {
+        	query.setRange( constraint.getRange()[0], constraint.getRange()[1] );
+        }
+
         if ( constraint.getDeclaredParameters() != null )
         {
             if ( constraint.getParameters() == null )
