title: Google App Engine Java Datastore Query - Limit Results?
body: <p>I am trying to fetch entries from the datastore and need to filter them by genre:</p>
  
  <pre class="lang-jsp prettyprint-override"><code>&lt;%@ page import="com.google.appengine.api.datastore.Query.Filter"%&gt;
  &lt;%@ page import="com.google.appengine.api.datastore.Query.FilterPredicate"%&gt;
  &lt;%@ page import="com.google.appengine.api.datastore.Query.FilterOperator"%&gt;
  &lt;%@ page import="com.google.appengine.api.datastore.*"%&gt;
  &lt;%@ page import="com.google.appengine.api.datastore.Query.*"%&gt;
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>Query confQuery = new Query("Track");
  Query.Filter topicFilter = new FilterPredicate("genre",
  FilterOperator.EQUAL, genre);
  confQuery.setFilter(topicFilter);
  confQuery.addSort("lastplayed", SortDirection.ASCENDING);
  PreparedQuery results = datastore.prepare(confQuery);
  </code></pre>
  
  <p>This will always return all of the entries with the given genre. How can I limit this to e.g. 10 entries?</p>