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

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


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

    beginTxn();
    Child child = em.find(childClass, e.getKey());
    assertEquals(childClass, child.getClass());
    assertEquals("a", child.getAString());
    assertEquals("b", child.getBString());
    commitTxn();
  }
View Full Code Here


    ds.put(e3);

    beginTxn();
    Query q = em.createQuery("select from " + childClass.getName() + " b where aString = :p");
    q.setParameter("p", "a2");
    Child child = (Child) q.getResultList().get(0);
    assertEquals(childClass, child.getClass());
    assertEquals("a2", child.getAString());
    assertEquals("b2", child.getBString());

    q = em.createQuery("select from " + childClass.getName() + " b where bString = :p");
    q.setParameter("p", "b2");
    child = (Child) q.getSingleResult();
    assertEquals(childClass, child.getClass());
    assertEquals("a2", child.getAString());
    assertEquals("b2", child.getBString());

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

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

    beginTxn();
    Child child = em.find(childClass, e.getKey());
    em.remove(child);
    commitTxn();
    try {
      ds.get(e.getKey());
      fail("expected exception");
View Full Code Here

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

    beginTxn();
    Child child = em.find(grandchildClass, e.getKey());
    em.remove(child);
    commitTxn();
    try {
      ds.get(e.getKey());
      fail("expected exception");
View Full Code Here

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

    beginTxn();
    Child child = em.find(childClass, e.getKey());
    child.setAString("not a");
    child.setBString("not b");
    commitTxn();
    e = ds.get(e.getKey());
    assertEquals("not a", e.getProperty("aString"));
    assertEquals("not b", e.getProperty("bString"));
  }
View Full Code Here

TOP

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

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.