Package org.apache.art

Examples of org.apache.art.BinaryPKTest1


    public void testInsertBinaryPK() throws Exception {
        if (!getAccessStackAdapter().supportsBinaryPK()) {
            return;
        }

        BinaryPKTest1 master = (BinaryPKTest1) context.newObject("BinaryPKTest1");
        master.setName("master1");

        BinaryPKTest2 detail = (BinaryPKTest2) context.newObject("BinaryPKTest2");
        detail.setDetailName("detail2");

        master.addToBinaryPKDetails(detail);

        context.commitChanges();

    }
View Full Code Here


    public void testFetchRelationshipBinaryPK() throws Exception {
        if (!getAccessStackAdapter().supportsBinaryPK()) {
            return;
        }

        BinaryPKTest1 master = (BinaryPKTest1) context.newObject("BinaryPKTest1");
        master.setName("master1");

        BinaryPKTest2 detail = (BinaryPKTest2) context.newObject("BinaryPKTest2");
        detail.setDetailName("detail2");

        master.addToBinaryPKDetails(detail);

        context.commitChanges();

        // create new context
        context = createDataContext();
        BinaryPKTest2 fetchedDetail = (BinaryPKTest2) context.performQuery(
                new SelectQuery(BinaryPKTest2.class)).get(0);

        assertNotNull(fetchedDetail.readPropertyDirectly("toBinaryPKMaster"));

        BinaryPKTest1 fetchedMaster = fetchedDetail.getToBinaryPKMaster();
        assertNotNull(fetchedMaster);
        assertEquals(PersistenceState.HOLLOW, fetchedMaster.getPersistenceState());
        assertEquals("master1", fetchedMaster.getName());
    }
View Full Code Here

TOP

Related Classes of org.apache.art.BinaryPKTest1

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.