Package com.google.appengine.datanucleus.test.jdo

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


    assertNotNull(parent.getHasParent().getParent());
    commitTxn();
  }

  public void testOneToOnePersistChildWithAncestorCascadeAll() throws EntityNotFoundException {
    HasOneToOnesWithDifferentCascadesJDO parent = new HasOneToOnesWithDifferentCascadesJDO();
    HasStringAncestorStringPkJDO child = new HasStringAncestorStringPkJDO();
    parent.setCascadeAllChild(child);

    beginTxn();
    pm.makePersistent(parent);
    commitTxn();

    beginTxn();
    parent = pm.getObjectById(HasOneToOnesWithDifferentCascadesJDO.class, parent.getId());
    assertNotNull(parent.getCascadeAllChild());
    child = pm.getObjectById(HasStringAncestorStringPkJDO.class, child.getId());
    assertEquals(parent.getId(), child.getAncestorId());
    commitTxn();

    Entity childEntity = ds.get(KeyFactory.stringToKey(child.getId()));
    assertKeyParentEquals(parent.getId(), childEntity, childEntity.getKey());
  }
View Full Code Here


    Entity childEntity = ds.get(KeyFactory.stringToKey(child.getId()));
    assertKeyParentEquals(parent.getId(), childEntity, childEntity.getKey());
  }

  public void testOneToOnePersistChildWithKeyAncestorCascadeAll() throws EntityNotFoundException {
    HasOneToOnesWithDifferentCascadesJDO parent = new HasOneToOnesWithDifferentCascadesJDO();
    HasKeyAncestorStringPkJDO child = new HasKeyAncestorStringPkJDO();
    parent.setCascadeAllChildWithKeyAncestor(child);

    beginTxn();
    pm.makePersistent(parent);
    commitTxn();

    beginTxn();
    parent = pm.getObjectById(HasOneToOnesWithDifferentCascadesJDO.class, parent.getId());
    child = pm.getObjectById(HasKeyAncestorStringPkJDO.class, child.getKey());
    assertEquals(parent.getId(), KeyFactory.keyToString(child.getAncestorKey()));
    assertNotNull(parent.getCascadeAllChildWithKeyAncestor());
    commitTxn();

    Entity childEntity = ds.get(KeyFactory.stringToKey(child.getKey()));
    assertKeyParentEquals(parent.getId(), childEntity, childEntity.getKey());
  }
View Full Code Here

    Entity childEntity = ds.get(KeyFactory.stringToKey(child.getKey()));
    assertKeyParentEquals(parent.getId(), childEntity, childEntity.getKey());
  }

  public void testOneToOnePersistCascadePersist() throws EntityNotFoundException {
    HasOneToOnesWithDifferentCascadesJDO parent = new HasOneToOnesWithDifferentCascadesJDO();
    HasStringAncestorKeyPkJDO child = new HasStringAncestorKeyPkJDO();
    parent.setCascadePersistChild(child);

    beginTxn();
    pm.makePersistent(parent);
    commitTxn();

    beginTxn();
    parent = pm.getObjectById(HasOneToOnesWithDifferentCascadesJDO.class, parent.getId());
    child = pm.getObjectById(HasStringAncestorKeyPkJDO.class, child.getKey());
    assertEquals(parent.getId(), child.getAncestorKey());
    assertNotNull(parent.getCascadePersistChild());
    commitTxn();

    Entity childEntity = ds.get(child.getKey());
    assertKeyParentEquals(parent.getId(), childEntity, childEntity.getKey());
  }
View Full Code Here

    Entity childEntity = ds.get(child.getKey());
    assertKeyParentEquals(parent.getId(), childEntity, childEntity.getKey());
  }

  public void testOneToOnePersistCascadeRemove() throws EntityNotFoundException {
    HasOneToOnesWithDifferentCascadesJDO parent = new HasOneToOnesWithDifferentCascadesJDO();
    HasKeyAncestorKeyPkJDO child = new HasKeyAncestorKeyPkJDO();
    parent.setCascadeRemoveChild(child);

    beginTxn();
    pm.makePersistent(child);
    commitTxn();
    beginTxn();
View Full Code Here

      rollbackTxn();
    }
  }

  public void testOneToOnePersistCascadeAll_OverrideParentManually() {
    HasOneToOnesWithDifferentCascadesJDO parent = new HasOneToOnesWithDifferentCascadesJDO();

    HasOneToOnesWithDifferentCascadesJDO anotherParent = new HasOneToOnesWithDifferentCascadesJDO();
    beginTxn();
    pm.makePersistent(anotherParent);
    commitTxn();

    HasStringAncestorStringPkJDO child = new HasStringAncestorStringPkJDO(anotherParent.getId());
    parent.setCascadeAllChild(child);

    beginTxn();
    try {
      pm.makePersistent(parent);
View Full Code Here

      rollbackTxn();
    }
  }

  public void testOneToOnePersistCascadePersist_OverrideParentManually() {
    HasOneToOnesWithDifferentCascadesJDO parent = new HasOneToOnesWithDifferentCascadesJDO();

    HasOneToOnesWithDifferentCascadesJDO anotherParent = new HasOneToOnesWithDifferentCascadesJDO();
    beginTxn();
    pm.makePersistent(anotherParent);
    commitTxn();

    HasStringAncestorKeyPkJDO child = new HasStringAncestorKeyPkJDO();
    child.setAncestorKey(anotherParent.getId());
    parent.setCascadePersistChild(child);

    beginTxn();
    try {
      pm.makePersistent(parent);
View Full Code Here

    ds.put(childEntity);
    parentEntity.setProperty("cascadeall", childEntity.getKey());
    ds.put(parentEntity);

    beginTxn();
    HasOneToOnesWithDifferentCascadesJDO parent = pm.getObjectById(
        HasOneToOnesWithDifferentCascadesJDO.class, KeyFactory.keyToString(parentEntity.getKey()));
    assertNotNull(parent.getCascadeAllChild());
    pm.deletePersistent(parent);
    commitTxn();

    try {
      ds.get(parentEntity.getKey());
View Full Code Here

    ds.put(childEntity);
    parentEntity.setProperty("cascadeall", childEntity.getKey());
    ds.put(parentEntity);

    beginTxn();
    HasOneToOnesWithDifferentCascadesJDO parent = pm.getObjectById(
        HasOneToOnesWithDifferentCascadesJDO.class, KeyFactory.keyToString(parentEntity.getKey()));
    assertNotNull(parent.getCascadeAllChild());
    assertKeyParentEquals(parent.getId(), childEntity, parent.getCascadeAllChild().getId());
    pm.deletePersistent(parent.getCascadeAllChild());
    commitTxn();

    parentEntity = ds.get(parentEntity.getKey());
    assertEquals(childEntity.getKey(), parentEntity.getProperty("cascadeall"));
    try {
View Full Code Here

    ds.put(childEntity);
    parentEntity.setProperty("cascaderemove", childEntity.getKey());
    ds.put(parentEntity);

    beginTxn();
    HasOneToOnesWithDifferentCascadesJDO parent = pm.getObjectById(
        HasOneToOnesWithDifferentCascadesJDO.class, KeyFactory.keyToString(parentEntity.getKey()));
    assertNotNull(parent.getCascadeRemoveChild());
    assertKeyParentEquals(parent.getId(), childEntity, parent.getCascadeRemoveChild().getKey());
    pm.deletePersistent(parent.getCascadeRemoveChild());
    commitTxn();

    parentEntity = ds.get(parentEntity.getKey());
    assertEquals(childEntity.getKey(), parentEntity.getProperty("cascaderemove"));
    try {
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jdo.HasOneToOnesWithDifferentCascadesJDO

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.