PageRenderTime 105ms CodeModel.GetById 98ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/src/com/google/appengine/datanucleus/query/JPACursorHelper.java

http://datanucleus-appengine.googlecode.com/
Java | 53 lines | 7 code | 5 blank | 41 comment | 0 complexity | 1af031a55d649b0fce07cf8847ec5bd4 MD5 | raw file
 1/*
 2 * Copyright (C) 2010 Google Inc
 3 *
 4 * Licensed under the Apache License, Version 2.0 (the "License");
 5 * you may not use this file except in compliance with the License.
 6 * You may obtain a copy of the License at
 7 *
 8 * http://www.apache.org/licenses/LICENSE-2.0
 9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package com.google.appengine.datanucleus.query;
17
18import com.google.appengine.api.datastore.Cursor;
19
20import javax.persistence.Query;
21
22/**
23 * Utilities for working with {@link Cursor} through the JPA
24 * {@link Query} api.
25 * <br>
26 * To add a Cursor to a query, set the Cursor as an extension:
27 * <blockquote>
28 * <pre>
29 * Query q = em.createQuery(Flight.class);
30 * q.setFirstResult(100);
31 * q.setMaxResults(100);
32 * q.setHint(JpaCursorHelper.CURSOR_HINT, cursor);
33 * List<Flight> flights = q.getResultList();
34 * </pre>
35 * </blockquote>
36 * Note that in this esample {@code cursor} can be either of type
37 * {@link Cursor} or a {@link String} representation of Cursor obtained by
38 * calling {@link Cursor#toWebSafeString()}.
39 *<br>
40 * To extract a Cursor from a result set, call {@link #getCursor(java.util.List)}
41 * with the result set as the argument.
42 *<br>
43 * This class is part of the public api of the DataNucleus App Engine plugin
44 * and can be safely used.
45 *
46 * @author Max Ross <max.ross@gmail.com>
47 */
48public final class JPACursorHelper extends CursorHelper {
49
50  public static final String CURSOR_HINT = QUERY_CURSOR_PROPERTY_NAME;
51
52  private JPACursorHelper() {}
53}