Examples of UnownedJDOOneToOneUniSideB


Examples of com.google.appengine.datanucleus.test.jdo.UnownedJDOOneToOneUniSideB

  public void testPersistUniNewBoth() throws EntityNotFoundException {
    // Persist A-B as unowned
    UnownedJDOOneToOneUniSideA a = new UnownedJDOOneToOneUniSideA();
    a.setName("Side A");
    UnownedJDOOneToOneUniSideB b = new UnownedJDOOneToOneUniSideB();
    b.setName("Side B");
    a.setOther(b);

    pm.makePersistent(a);

    Object aId = pm.getObjectId(a);
    Object bId = pm.getObjectId(b);

    pm.evictAll(); // Make sure we go to the datastore

    // Retrieve by id and check
    UnownedJDOOneToOneUniSideA a2 = (UnownedJDOOneToOneUniSideA)pm.getObjectById(aId);
    assertNotNull(a2);
    assertEquals("Side A", a2.getName());
    UnownedJDOOneToOneUniSideB b2 = a.getOther();
    assertNotNull(b2);
    assertNotNull("Side B", b2.getName());
    assertEquals(bId, pm.getObjectId(b2));
  }
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jdo.UnownedJDOOneToOneUniSideB

    assertEquals(bId, pm.getObjectId(b2));
  }

  public void testPersistUniNewAExistingB() throws EntityNotFoundException {
    // Persist B
    UnownedJDOOneToOneUniSideB b = new UnownedJDOOneToOneUniSideB();
    b.setName("Side B");
    pm.makePersistent(b);
    Object bId = pm.getObjectId(b);

    // Persist A linked to B
    UnownedJDOOneToOneUniSideA a = new UnownedJDOOneToOneUniSideA();
    a.setName("Side A");
    a.setOther(b);
    pm.makePersistent(a);
    Object aId = pm.getObjectId(a);

    pm.evictAll(); // Make sure we go to the datastore

    // Retrieve by id and check
    UnownedJDOOneToOneUniSideA a2 = (UnownedJDOOneToOneUniSideA)pm.getObjectById(aId);
    assertNotNull(a2);
    assertEquals("Side A", a2.getName());
    UnownedJDOOneToOneUniSideB b2 = a.getOther();
    assertNotNull(b2);
    assertNotNull("Side B", b2.getName());
    assertEquals(bId, pm.getObjectId(b2));
  }
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jdo.UnownedJDOOneToOneUniSideB

  public void testUnownedQuery() {

    // create parent without children, store, detach
    UnownedJDOOneToOneUniSideA a = new UnownedJDOOneToOneUniSideA();
    UnownedJDOOneToOneUniSideB b = new UnownedJDOOneToOneUniSideB();
    a.setOther(b);

    pm.makePersistent(a);
    UnownedJDOOneToOneUniSideB detachedB = pm.detachCopy(b);
    pm.close();

    pm = pmf.getPersistenceManager();

    javax.jdo.Query q = pm.newQuery("SELECT FROM " + UnownedJDOOneToOneUniSideA.class.getName() +
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.