Package org.apache.cayenne.jpa.itest.ch2

Examples of org.apache.cayenne.jpa.itest.ch2._2_1_8_1_BidiOneToOneRelationshipsTest


                "id", "owned_id"
        }, new Object[] {
                5, 6
        });

        BidiOneToManyOwned owned = getEntityManager().find(BidiOneToManyOwned.class, 5);
        assertNotNull(owned);
        assertEquals(1, owned.getOwners().size());

        BidiOneToManyOwner owner = getEntityManager().find(BidiOneToManyOwner.class, 4);
        assertNotNull(owner);
        assertTrue(owned.getOwners().contains(owner));
       
        BidiOneToManyOwner owner1 = getEntityManager().find(BidiOneToManyOwner.class, 5);
        assertNotNull(owner1);
        assertFalse(owned.getOwners().contains(owner1));
    }
View Full Code Here


        BidiOneToManyOwned owned = getEntityManager().find(BidiOneToManyOwned.class, 5);
        assertNotNull(owned);
        assertEquals(1, owned.getOwners().size());

        BidiOneToManyOwner owner = getEntityManager().find(BidiOneToManyOwner.class, 4);
        assertNotNull(owner);
        assertTrue(owned.getOwners().contains(owner));
       
        BidiOneToManyOwner owner1 = getEntityManager().find(BidiOneToManyOwner.class, 5);
        assertNotNull(owner1);
        assertFalse(owned.getOwners().contains(owner1));
    }
View Full Code Here

                .insert(4, 5);

        BidiOneToOneOwner owner = getEntityManager().find(BidiOneToOneOwner.class, 4);
        assertNotNull(owner);

        BidiOneToOneOwned owned = getEntityManager().find(BidiOneToOneOwned.class, 5);
        assertNotNull(owned);

        assertSame(owned, owner.getOwned());
        assertSame(owner, owned.getOwner());
    }
View Full Code Here

        getTableHelper("BidiOneToOneOwner")
                .deleteAll()
                .setColumns("id", "owned_id")
                .insert(4, 5);

        BidiOneToOneOwner owner = getEntityManager().find(BidiOneToOneOwner.class, 4);
        assertNotNull(owner);

        BidiOneToOneOwned owned = getEntityManager().find(BidiOneToOneOwned.class, 5);
        assertNotNull(owned);

        assertSame(owned, owner.getOwned());
        assertSame(owner, owned.getOwner());
    }
View Full Code Here

            "id"
        }, new Object[] {
            new Integer(5)
        });

        CollectionFieldPersistenceEntity o1 = getEntityManager().find(
                CollectionFieldPersistenceEntity.class,
                new Integer(5));
        assertNotNull(o1);
        assertNotNull(o1.getCollection());
        assertTrue(o1.getCollection().isEmpty());
    }
View Full Code Here

                "id", "entity_id"
        }, new Object[] {
                new Integer(4), new Integer(5)
        });

        CollectionFieldPersistenceEntity o1 = getEntityManager().find(
                CollectionFieldPersistenceEntity.class,
                new Integer(5));
        assertNotNull(o1);
        assertNotNull(o1.getCollection());
        assertFalse(o1.getCollection().isEmpty());
    }
View Full Code Here

        getEntityManager().getTransaction().commit();
    }

    // TODO: andrus 8/30/2006 - fails
    public void _testCollectionTypesProperties() {
        CollectionFieldPersistenceEntity o1 = new CollectionFieldPersistenceEntity();
        o1.setCollection(Collections.singleton(new HelperEntity1()));
        o1.setSet(Collections.singleton(new HelperEntity2()));
        o1.setList(Collections.singletonList(new HelperEntity3()));

        getEntityManager().persist(o1);
        getEntityManager().getTransaction().commit();
    }
View Full Code Here

    // TODO: andrus 8/10/2006 - fails
    public void _testEmbeddedDefault() throws Exception {
        getDbHelper().deleteAll("EmbeddedImpliedEntity");

        EmbeddedImpliedEntity o1 = new EmbeddedImpliedEntity();
        Embeddable1 o2 = new Embeddable1();
        o2.setProperty1("p1");
        o1.setEmbeddable(o2);

        getEntityManager().persist(o1);
        getEntityManager().getTransaction().commit();
View Full Code Here

    public void testEmbeddable() throws Exception {
        getDbHelper().deleteAll("EmbeddedEntity");

        EmbeddedEntity o1 = new EmbeddedEntity();
        Embeddable1 o2 = new Embeddable1();
        o2.setProperty1("p1");
        o1.setEmbeddable(o2);

        getEntityManager().persist(o1);
        getEntityManager().getTransaction().commit();
View Full Code Here

public class _2_1_5_EmbeddableTest extends EntityManagerCase {

    public void testEmbeddable() throws Exception {
        getDbHelper().deleteAll("EmbeddedEntity");

        EmbeddedEntity o1 = new EmbeddedEntity();
        Embeddable1 o2 = new Embeddable1();
        o2.setProperty1("p1");
        o1.setEmbeddable(o2);

        getEntityManager().persist(o1);
        getEntityManager().getTransaction().commit();

        assertEquals("p1", getDbHelper().getObject("EmbeddedEntity", "property1"));
View Full Code Here

TOP

Related Classes of org.apache.cayenne.jpa.itest.ch2._2_1_8_1_BidiOneToOneRelationshipsTest

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.