Examples of EntityA


Examples of org.apache.jackrabbit.ocm.testmodel.interfaces.EntityA

  public void testListOfInterface() {

    try {
      ObjectContentManager ocm = getObjectContentManager();

      EntityA a = new EntityA();
      a.setPath("/test");

      List<MyInterface> bList = new ArrayList<MyInterface>();
      EntityB b = new EntityB();
      b.setId("ID_B");
      b.setName("NAME_B");
      bList.add(b);

      a.setEntityB(bList);

      ocm.insert(a);
      ocm.save();
     
     
      a = (EntityA) ocm.getObject("/test");
      bList = a.getEntityB();
      assertNotNull(bList);
      assertEquals(1, bList.size());
     
     
      ocm.remove("/test");
View Full Code Here

Examples of org.apache.jackrabbit.ocm.testmodel.interfaces.EntityA

  public void testListOfInterface() {

    try {
      ObjectContentManager ocm = this.getObjectContentManager();

      EntityA a = new EntityA();
      a.setPath("/test");

      List<MyInterface> bList = new ArrayList<MyInterface>();
      EntityB b = new EntityB();
      b.setId("ID_B");
      b.setName("NAME_B");
      bList.add(b);

      a.setEntityB(bList);

      ocm.insert(a);
      ocm.save();
     
     
      a = (EntityA) ocm.getObject("/test");
      bList = a.getEntityB();
      assertNotNull(bList);
      assertEquals(1, bList.size());
     
     
      ocm.remove("/test");
View Full Code Here

Examples of org.apache.openjpa.jdbc.kernel.EntityA

        OpenJPAEntityManagerSPI em2 = emf.createEntityManager();

        em1.getTransaction().begin();
        List<EntityA> entities = new ArrayList<EntityA>();
        for (int i = 0; i < 25; i++) {
            EntityA a = createEntity();
            entities.add(a);
            em1.persist(a);
        }
        em1.getTransaction().commit();
        em1.clear();

        em1.getTransaction().begin();
        em2.getTransaction().begin();
        for (EntityA a : entities) {
            EntityA a1 = em1.find(EntityA.class, a.getId());
            EntityA a2 = em2.find(EntityA.class, a.getId());
            a1.setName("asdf");
            a2.setName("asdf2");
        }
        em1.getTransaction().commit();
        try {
            em2.getTransaction().commit();
        } catch (RollbackException e) {
View Full Code Here

Examples of org.apache.openjpa.jdbc.kernel.EntityA

        }

    }

    EntityA createEntity() {
        EntityA res = new EntityA();
        EntityB b = new EntityB();
        EntityC c = new EntityC();
        EntityD d = new EntityD();

        res.setEntityB(b);
        b.setEntityC(c);
        c.setEntityD(d);

        return res;
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.entity.EntityA

    }
   
    public void testOpenJPA2330() {
        final EntityManager em = emf.createEntityManager();

        EntityA a = new EntityA();
        EntityB b = new EntityB(a);
        // set back pointer
        a.getBs().add(b);
       
        EntityC c = new EntityC(b);
        // set back pointer
        b.getCs().add(c);
View Full Code Here

Examples of org.apache.openjpa.persistence.entity.EntityA

    }
   
    public void testOpenJPA2330() {
        final EntityManager em = emf.createEntityManager();

        EntityA a = new EntityA();
        EntityB b = new EntityB(a);
        // set back pointer
        a.getBs().add(b);
       
        EntityC c = new EntityC(b);
        // set back pointer
        b.getCs().add(c);
View Full Code Here

Examples of org.apache.openjpa.persistence.entity.EntityA

    public void testOpenJPA2335() {
        EntityManager em = emf.createEntityManager();

        em.getTransaction().begin();
        EntityA a = new EntityA();

        EntityB b1 = new EntityB(a);
        b1.setName("b1");
        a.getBs().add(b1);

        EntityB b2 = new EntityB(a);
        b2.setName("b2");
        a.getBs().add(b2);

        EntityB b3 = new EntityB(a);
        b3.setName("b3");
        a.getBs().add(b3);

        EntityB b4 = new EntityB(a);
        b4.setName("b4");
        a.getBs().add(b4);

        em.persist(a);

        em.getTransaction().commit();
        em.close();

        // now read all back in
        em = emf.createEntityManager();
        em.getTransaction().begin();
        EntityA a2 = em.find(EntityA.class, a.getId());
        Assert.assertNotNull(a2);
        Assert.assertNotNull(a2.getBs());
        Assert.assertEquals(4, a2.getBs().size());

        Iterator<EntityB> it = a2.getBs().iterator();
        for (int i = 1; i <= 4; i++) {
            EntityB entityB = it.next();

            Assert.assertEquals("b" + i, entityB.getName());
        }
View Full Code Here

Examples of org.libreplan.business.util.deepcopy.EntityExamples.EntityA

        assertThat(copy.getSuperClassStringProperty(), equalTo("foo"));
    }

    @Test
    public void datesAreCopied() {
        EntityA entityA = new EntityA();
        Date originalDateValue = new Date();
        entityA.setDate(originalDateValue);
        EntityA copy = new DeepCopy().copy(entityA);
        assertThat(copy.getDate(), equalTo(originalDateValue));
        assertNotSame(originalDateValue, copy.getDate());
    }
View Full Code Here

Examples of org.libreplan.business.util.deepcopy.EntityExamples.EntityA

        assertNotSame(originalDateValue, copy.getDate());
    }

    @Test
    public void setsAreCopied() {
        EntityA entityA = new EntityA();
        HashSet<Object> originalSet = new HashSet<Object>(asList("test",
                2, 3, new Date()));
        entityA.setSetProperty(originalSet);
        EntityA copy = new DeepCopy().copy(entityA);
        assertEquals(originalSet, copy.getSetProperty());
        assertNotSame(originalSet, copy.getSetProperty());
    }
View Full Code Here

Examples of org.libreplan.business.util.deepcopy.EntityExamples.EntityA

        assertNotSame(originalSet, copy.getSetProperty());
    }

    @Test
    public void theSetImplementationClassIsPreservedIfPossible() {
        EntityA entityA = new EntityA();
        Set<Object> originalSet = new LinkedHashSet<Object>(asList("test", 2,
                3, new Date()));
        entityA.setSetProperty(originalSet);
        EntityA copy = new DeepCopy().copy(entityA);
        assertThat(copy.getSetProperty(), instanceOf(LinkedHashSet.class));
    }
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.