コード例 #1
0
 public void xtestNestQueryInFromClause() throws Exception {
   Region region = CacheUtils.createRegion("Portfolios", Portfolio.class);
   region.put("0", new Portfolio(0));
   region.put("1", new Portfolio(1));
   region.put("2", new Portfolio(2));
   region.put("3", new Portfolio(3));
   Query query =
       CacheUtils.getQueryService()
           .newQuery(
               "SELECT DISTINCT * FROM (SELECT DISTINCT * FROM /Portfolios where status = 'active') p  where p.ID = 0");
   //    DebuggerSupport.waitForJavaDebugger(CacheUtils.getLogger());
   Collection result = (Collection) query.execute();
   Portfolio p = (Portfolio) (result.iterator().next());
   if (!p.status.equals("active") || p.getID() != 0) fail(query.getQueryString());
 }
コード例 #2
0
  @Test
  public void testBug37119() throws Exception {
    Region region = CacheUtils.createRegion("portfolios", Portfolio.class);
    region.put("0", new Portfolio(0));
    region.put("1", new Portfolio(1));
    region.put("2", new Portfolio(2));
    region.put("3", new Portfolio(3));
    region.put(Integer.MIN_VALUE + "", new Portfolio(Integer.MIN_VALUE));
    region.put("-1", new Portfolio(-1));
    QueryService qs = CacheUtils.getQueryService();

    String qStr = "Select distinct * from /portfolios pf where pf.getID() = " + Integer.MIN_VALUE;
    Query q = qs.newQuery(qStr);
    SelectResults result = (SelectResults) q.execute();
    assertEquals(result.size(), 1);
    Portfolio pf = (Portfolio) result.iterator().next();
    assertEquals(pf.getID(), Integer.MIN_VALUE);
    qStr = "Select distinct * from /portfolios pf where pf.getID() = -1";
    q = qs.newQuery(qStr);
    result = (SelectResults) q.execute();
    assertEquals(result.size(), 1);
    pf = (Portfolio) result.iterator().next();
    assertEquals(pf.getID(), -1);

    qStr =
        "Select distinct * from /portfolios pf where pf.getID() = 3 and pf.getLongMinValue() = "
            + Long.MIN_VALUE
            + 'l';
    q = qs.newQuery(qStr);
    result = (SelectResults) q.execute();
    assertEquals(result.size(), 1);
    pf = (Portfolio) result.iterator().next();
    assertEquals(pf.getID(), 3);

    qStr =
        "Select distinct * from /portfolios pf where pf.getID() = 3 and pf.getFloatMinValue() = "
            + Float.MIN_VALUE
            + 'f';
    q = qs.newQuery(qStr);
    result = (SelectResults) q.execute();
    assertEquals(result.size(), 1);
    pf = (Portfolio) result.iterator().next();
    assertEquals(pf.getID(), 3);

    qStr =
        "Select distinct * from /portfolios pf where pf.getID() = 3 and pf.getDoubleMinValue() = "
            + Double.MIN_VALUE;
    q = qs.newQuery(qStr);
    result = (SelectResults) q.execute();
    assertEquals(result.size(), 1);
    pf = (Portfolio) result.iterator().next();
    assertEquals(pf.getID(), 3);
  }