Package javax.jdo

Examples of javax.jdo.Query.addExtension()


  public void testBatchGet_Illegal() {
    commitTxn();
    switchDatasource(PersistenceManagerFactoryName.nontransactional);
    Query q = pm.newQuery("select from " + Flight.class.getName() + " where origin == :ids");
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "false");
    try {
      q.execute(Utils.newArrayList());
      fail("expected exception");
    } catch (JDOFatalUserException e) {
      // good
View Full Code Here


    } catch (JDOFatalUserException e) {
      // good
    }

    q = pm.newQuery("select from " + Flight.class.getName() + " where id == :ids && origin == :origin");
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "false");
    try {
      q.execute(Utils.newArrayList(), "bos");
      fail("expected exception");
    } catch (JDOFatalUserException e) {
      // good
View Full Code Here

    } catch (JDOFatalUserException e) {
      // good
    }

    q = pm.newQuery("select from " + Flight.class.getName() + " where origin == :origin && id == :ids");
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "false");
    try {
      q.execute("bos", Utils.newArrayList());
      fail("expected exception");
    } catch (JDOFatalUserException e) {
      // good
View Full Code Here

    } catch (JDOFatalUserException e) {
      // good
    }

    q = pm.newQuery("select from " + Flight.class.getName() + " where id > :ids");
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "false");
    try {
      q.execute(Utils.newArrayList());
      fail("expected exception");
    } catch (JDOFatalUserException e) {
      // good
View Full Code Here

    } catch (JDOFatalUserException e) {
      // good
    }

    q = pm.newQuery("select from " + Flight.class.getName() + " where id == :ids order by id");
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "false");
    try {
      q.execute(Utils.newArrayList());
      fail("expected exception");
    } catch (JDOFatalUserException e) {
      // good
View Full Code Here

    assertEquals(1, result.size());
  }

  public void testAggregateInFilterFails() {
    Query q = pm.newQuery("select from " + Flight.class.getName() + " where you == max(you)");
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "false");
    try {
      q.execute();
      fail("expected exception");
    } catch (JDOUserException jdoe) {
        if (jdoe.getCause() instanceof DatastoreQuery.UnsupportedDatastoreFeatureException) {
View Full Code Here

    ds.put(null, e2);
    Entity e3 = Flight.newFlightEntity("z", "bos", "mia", 24, 25);
    ds.put(null, e3);

    Query q = pm.newQuery("select from " + Flight.class.getName() + " where name.endsWith(\"y\")");
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "true");
    @SuppressWarnings("unchecked")
    List<Flight> flights = (List<Flight>) q.execute();
    assertEquals(1, flights.size());

    q = pm.newQuery("select from " + Flight.class.getName() + " where name.endsWith(\"am\")");
View Full Code Here

    @SuppressWarnings("unchecked")
    List<Flight> flights = (List<Flight>) q.execute();
    assertEquals(1, flights.size());

    q = pm.newQuery("select from " + Flight.class.getName() + " where name.endsWith(\"am\")");
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "true");
    @SuppressWarnings("unchecked")
    List<Flight> flights2 = (List<Flight>) q.execute();
    assertEquals(1, flights2.size());

    q = pm.newQuery("select from " + Flight.class.getName() + " where name.endsWith(\"za\")");
View Full Code Here

    @SuppressWarnings("unchecked")
    List<Flight> flights2 = (List<Flight>) q.execute();
    assertEquals(1, flights2.size());

    q = pm.newQuery("select from " + Flight.class.getName() + " where name.endsWith(\"za\")");
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "true");
    @SuppressWarnings("unchecked")
    List<Flight> flights3 = (List<Flight>) q.execute();
    assertTrue(flights3.isEmpty());
  }
View Full Code Here

    Entity e2 = newFlightEntity("harold", "bos", "mia", 33, 34, 35);
    ds.put(null, e1);
    ds.put(null, e2);

    Query q = pm.newQuery("select max(me) from " + Flight.class.getName());
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "true");
    assertEquals(34, q.execute());
  }

  public void testCountQueryWithFilter_SingleString() {
    Entity e1 = newFlightEntity("harold", "bos", "mia", 23, 24, 25);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.