Package com.google.appengine.datanucleus.test.jpa.SubclassesJPA

Examples of com.google.appengine.datanucleus.test.jpa.SubclassesJPA.Grandchild


    e.setProperty("bString", "b");
    e.setProperty("cString", "c");
    ds.put(e);

    beginTxn();
    Grandchild grandchild = em.find(grandchildClass, e.getKey());
    assertEquals(grandchildClass, grandchild.getClass());
    assertEquals("a", grandchild.getAString());
    assertEquals("b", grandchild.getBString());
    assertEquals("c", grandchild.getCString());
    commitTxn();
  }
View Full Code Here


    beginTxn();
    Query q = em.createQuery(
        "select from " + grandchildClass.getName() + " b where aString = :p");
    q.setParameter("p", "a2");
    Grandchild grandchild = (Grandchild) q.getResultList().get(0);

    assertEquals(grandchildClass, grandchild.getClass());
    assertEquals("a2", grandchild.getAString());
    assertEquals("b1", grandchild.getBString());
    assertEquals("c2", grandchild.getCString());

    q = em.createQuery(
        "select from " + grandchildClass.getName() + " b where bString = :p");
    q.setParameter("p", "b2");
    grandchild = (Grandchild) q.getSingleResult();

    assertEquals(grandchildClass, grandchild.getClass());
    assertEquals("a2", grandchild.getAString());
    assertEquals("b2", grandchild.getBString());
    assertEquals("c3", grandchild.getCString());

    q = em.createQuery(
        "select from " + grandchildClass.getName() + " b where cString = :p");
    q.setParameter("p", "c2");
    grandchild = (Grandchild) q.getSingleResult();

    assertEquals(grandchildClass, grandchild.getClass());
    assertEquals("a2", grandchild.getAString());
    assertEquals("b1", grandchild.getBString());
    assertEquals("c2", grandchild.getCString());

    List<Grandchild> grandkids = ((List<Grandchild>) em.createQuery(
        "select from " + grandchildClass.getName() + " b where aString = 'a2' order by bString desc").getResultList());
    assertEquals(3, grandkids.size());
    assertEquals(e2.getKey().getId(), grandkids.get(0).getId().longValue());
View Full Code Here

    e.setProperty("aString", "a");
    e.setProperty("bString", "b");
    ds.put(e);

    beginTxn();
    Grandchild grandchild = em.find(grandchildClass, e.getKey());
    grandchild.setAString("not a");
    grandchild.setBString("not b");
    grandchild.setCString("not c");
    commitTxn();
    e = ds.get(e.getKey());
    assertEquals("not a", e.getProperty("aString"));
    assertEquals("not b", e.getProperty("bString"));
    assertEquals("not c", e.getProperty("cString"));
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jpa.SubclassesJPA.Grandchild

Copyright © 2018 www.massapicom. 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.