Examples of declareVariables()


Examples of javax.jdo.Query.declareVariables()

    pm.currentTransaction().commit();
     
    pm.currentTransaction().begin();
    Query q = pm.newQuery(Sensor.class);
    q.setFilter("((area.rooms.contains(r)) && (r.roomid == rid) && (states.contains(s)) && (s.stateid == sid))");
    q.declareVariables("Room r; StateItf s");
    q.declareParameters("int sid, int rid");
    Collection c = (Collection) q.execute(new Integer(102), new Integer(103));
    pm.currentTransaction().commit();

    autoClean(pm, classes);
View Full Code Here

Examples of javax.jdo.Query.declareVariables()

        }
        if (this.filter != null) {
            query.setFilter(this.filter);
        }
        if (this.variables != null) {
            query.declareVariables(this.variables);
        }
        if (this.parameters != null) {
            query.declareParameters(this.parameters);
        }
        if (this.imports != null ) {
View Full Code Here

Examples of javax.jdo.Query.declareVariables()

    beginTxn();
    Query q = pm.newQuery(
        "select from " + Student.class.getName() + " where "
        + "courses.contains(c) && c.department == 'Biology' && "
        + "grade == 10");
    q.declareVariables(Course.class.getName() + " c");
    assertEquals(Collections.singletonList(student), q.execute());
    commitTxn();
  }

  public void testJoinOnOneToMany_LegalOrderBy() {
View Full Code Here

Examples of javax.jdo.Query.declareVariables()

    beginTxn();
    Query q = pm.newQuery(
        "select from " + Student.class.getName() + " where "
        + "courses.contains(c) && c.department == 'Biology' && "
        + "grade == 10 order by courses asc");
    q.declareVariables(Course.class.getName() + " c");
    assertEquals(Collections.singletonList(student), q.execute());
    commitTxn();
  }

  public void testJoinOnOneToMany_Offset() {
View Full Code Here

Examples of javax.jdo.Query.declareVariables()

    beginTxn();
    Query q = pm.newQuery(
        "select from " + Student.class.getName() + " where "
        + "courses.contains(c) && c.department == 'Biology' && "
        + "grade == 10");
    q.declareVariables(Course.class.getName() + " c");
    q.setRange(1, Long.MAX_VALUE);
    assertEquals(Collections.singletonList(student3), q.execute());
    q.setRange(2, Long.MAX_VALUE);
    assertEquals(Collections.emptyList(), q.execute());
    commitTxn();
View Full Code Here

Examples of javax.jdo.Query.declareVariables()

    beginTxn();
    Query q = pm.newQuery(
        "select from " + Student.class.getName() + " where "
        + "courses.contains(c) && c.department == 'Biology' && "
        + "grade == 10");
    q.declareVariables(Course.class.getName() + " c");
    q.setRange(0, 1);
    assertEquals(Collections.singletonList(student), q.execute());
    q.setRange(0, 0);
    assertEquals(Collections.emptyList(), q.execute());
    commitTxn();
View Full Code Here

Examples of javax.jdo.Query.declareVariables()

    beginTxn();
    Query q = pm.newQuery(
        "select from " + Student.class.getName() + " where "
        + "major == m && m.school == 'Liberal Arts' && "
        + "grade == 10");
    q.declareVariables(Major.class.getName() + " m");
    assertEquals(Collections.singletonList(student1), q.execute());
    commitTxn();
  }

  public void testJoinOnOneToMany_Illegal() {
View Full Code Here

Examples of javax.jdo.Query.declareVariables()

    // join condition can't be >
    Query q = pm.newQuery(
        "select from " + Student.class.getName() + " where "
        + "courses > c && c.department == 'Biology' && "
        + "grade == 10");
    q.declareVariables(Course.class.getName() + " c");
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "false");
    try {
      q.execute();
      fail("expected exception");
    } catch (JDOUserException jdoe) {
View Full Code Here

Examples of javax.jdo.Query.declareVariables()

    // all filters on parent must be equality filters
    q = pm.newQuery(
        "select from " + Student.class.getName() + " where "
        + "courses.contains(c) && c.department == 'Biology' && "
        + "grade > 10");
    q.declareVariables(Course.class.getName() + " c");
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "false");
    try {
      q.execute();
      fail("expected exception");
    } catch (JDOUserException jdoe) {
View Full Code Here

Examples of javax.jdo.Query.declareVariables()

    // all filters on child must be equality filters
    q = pm.newQuery(
        "select from " + Student.class.getName() + " where "
        + "courses.contains(c) && c.department > 'Biology' && "
        + "grade == 10");
    q.declareVariables(Course.class.getName() + " c");
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "false");
    try {
      q.execute();
      fail("expected exception");
    } catch (JDOUserException jdoe) {
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.