Package org.apache.openjpa.persistence.datacache.common.apps

Examples of org.apache.openjpa.persistence.datacache.common.apps.EmbeddingOwnerEntity


                && emf.getConfiguration().getDataCacheManagerInstance()
            .getSystemDataCache() != null;
  }
 
  public void createData() {
    EmbeddingOwnerEntity owner = new EmbeddingOwnerEntity();
    for (int i = 0; i < SIZE; i++) {
      EmbeddedEntity member = new EmbeddedEntity();
      member.setMarker("Member-" + i);
      owner.addMember(member);
    }
    EntityManager em = emf.createEntityManager();
    em.getTransaction().begin();
    em.persist(owner);
    em.getTransaction().commit();
    Object id = OpenJPAPersistence.cast(em).getObjectId(owner);
    em.clear();

        EmbeddingOwnerEntity test = em.find(EmbeddingOwnerEntity.class, id);
    assertNotNull(test);
    List<EmbeddedEntity> members = test.getMembers();
    assertNotNull(members);
    assertEquals(SIZE, members.size());
    for (int i = 0; i < SIZE; i++)
      members.get(i).getMarker().equals("Member-" + i);
  }
View Full Code Here


                "SELECT p FROM EmbeddingOwnerEntity p").getResultList();

    assertNotNull(result);
    assertFalse(result.isEmpty());

    EmbeddingOwnerEntity owner = result.get(0);
    Object id = owner.getId();
   
        assertTrue(emf.getStoreCache().contains(EmbeddingOwnerEntity.class,
                id));
   
    List<EmbeddedEntity> members = owner.getMembers();
    members.remove(0);
    owner.removeMember(0);
    owner.removeMember(members.get(0));
    em.getTransaction().commit();
   
    assertEquals(owner.getMembers().size(), SIZE-3);
  }
View Full Code Here

  public void tearDown() throws Exception {
   
  }
 
  public void createData() {
    EmbeddingOwnerEntity owner = new EmbeddingOwnerEntity();
    for (int i = 0; i < SIZE; i++) {
      EmbeddedEntity member = new EmbeddedEntity();
      member.setMarker("Member-" + i);
      owner.addMember(member);
    }
    EntityManager em = emf.createEntityManager();
    em.getTransaction().begin();
    em.persist(owner);
    em.getTransaction().commit();
    Object id = OpenJPAPersistence.cast(em).getObjectId(owner);
    em.clear();

    EmbeddingOwnerEntity test = em.find(EmbeddingOwnerEntity.class, id);
    assertNotNull(test);
    List<EmbeddedEntity> members = test.getMembers();
    assertNotNull(members);
    assertEquals(SIZE, members.size());
    for (int i = 0; i < SIZE; i++)
      members.get(i).getMarker().equals("Member-" + i);
  }
View Full Code Here

        "SELECT p FROM EmbeddingOwnerEntity p").getResultList();

    assertNotNull(result);
    assertFalse(result.isEmpty());

    EmbeddingOwnerEntity owner = result.get(0);
    Object id = owner.getId();
   
    assertTrue(emf.getStoreCache().contains(EmbeddingOwnerEntity.class, id));
   
    List<EmbeddedEntity> members = owner.getMembers();
    members.remove(0);
    owner.removeMember(0);
    owner.removeMember(members.get(0));
    em.getTransaction().commit();
   
    assertEquals(owner.getMembers().size(), SIZE-3);
  }
View Full Code Here

  public void tearDown() throws Exception {
   
  }
 
  public void createData() {
    EmbeddingOwnerEntity owner = new EmbeddingOwnerEntity();
    for (int i = 0; i < SIZE; i++) {
      EmbeddedEntity member = new EmbeddedEntity();
      member.setMarker("Member-" + i);
      owner.addMember(member);
    }
    EntityManager em = emf.createEntityManager();
    em.getTransaction().begin();
    em.persist(owner);
    em.getTransaction().commit();
    Object id = OpenJPAPersistence.cast(em).getObjectId(owner);
    em.clear();

        EmbeddingOwnerEntity test = em.find(EmbeddingOwnerEntity.class, id);
    assertNotNull(test);
    List<EmbeddedEntity> members = test.getMembers();
    assertNotNull(members);
    assertEquals(SIZE, members.size());
    for (int i = 0; i < SIZE; i++)
      members.get(i).getMarker().equals("Member-" + i);
  }
View Full Code Here

                "SELECT p FROM EmbeddingOwnerEntity p").getResultList();

    assertNotNull(result);
    assertFalse(result.isEmpty());

    EmbeddingOwnerEntity owner = result.get(0);
    Object id = owner.getId();
   
        assertTrue(emf.getStoreCache().contains(EmbeddingOwnerEntity.class,
                id));
   
    List<EmbeddedEntity> members = owner.getMembers();
    members.remove(0);
    owner.removeMember(0);
    owner.removeMember(members.get(0));
    em.getTransaction().commit();
   
    assertEquals(owner.getMembers().size(), SIZE-3);
  }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.persistence.datacache.common.apps.EmbeddingOwnerEntity

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.