Package org.apache.art

Examples of org.apache.art.CompoundPkTestEntity


        Map<String, String> pk = new HashMap<String, String>();
        pk.put(CompoundPkTestEntity.KEY1_PK_COLUMN, "a1");
        pk.put(CompoundPkTestEntity.KEY2_PK_COLUMN, "a2");

        CompoundPkTestEntity a = DataObjectUtils.objectForPK(
                context,
                CompoundPkTestEntity.class,
                pk);

        String template = "SELECT * FROM COMPOUND_FK_TEST t0"
View Full Code Here


        Map<String, String> pk = new HashMap<String, String>();
        pk.put(CompoundPkTestEntity.KEY1_PK_COLUMN, "a1");
        pk.put(CompoundPkTestEntity.KEY2_PK_COLUMN, "a2");

        CompoundPkTestEntity a = DataObjectUtils.objectForPK(
                context,
                CompoundPkTestEntity.class,
                pk);

        String template = "SELECT * FROM COMPOUND_FK_TEST t0"
View Full Code Here

        ObjectContext context = createDataContext();

        Map<String, String> key1 = new HashMap<String, String>();
        key1.put(CompoundPkTestEntity.KEY1_PK_COLUMN, "b1");
        key1.put(CompoundPkTestEntity.KEY2_PK_COLUMN, "b2");
        CompoundPkTestEntity a = DataObjectUtils.objectForPK(
                context,
                CompoundPkTestEntity.class,
                key1);

        String ejbql = "select e from CompoundFkTestEntity e WHERE e.toCompoundPk = :param";
View Full Code Here

        ObjectContext context = createDataContext();

        Map<String, String> key1 = new HashMap<String, String>();
        key1.put(CompoundPkTestEntity.KEY1_PK_COLUMN, "b1");
        key1.put(CompoundPkTestEntity.KEY2_PK_COLUMN, "b2");
        CompoundPkTestEntity a = DataObjectUtils.objectForPK(
                context,
                CompoundPkTestEntity.class,
                key1);

        String ejbql = "select e from CompoundFkTestEntity e WHERE :param = e.toCompoundPk";
View Full Code Here

        ObjectContext context = createDataContext();

        Map<String, String> key1 = new HashMap<String, String>();
        key1.put(CompoundPkTestEntity.KEY1_PK_COLUMN, "b1");
        key1.put(CompoundPkTestEntity.KEY2_PK_COLUMN, "b2");
        CompoundPkTestEntity a = DataObjectUtils.objectForPK(
                context,
                CompoundPkTestEntity.class,
                key1);

        String ejbql = "select e from CompoundFkTestEntity e WHERE e.toCompoundPk <> :param";
View Full Code Here

        deleteTestData();
        ctxt = createDataContext();
    }

    public void testInsert() {
        CompoundPkTestEntity master = ctxt
                .newObject(CompoundPkTestEntity.class);
        CompoundFkTestEntity detail = ctxt
                .newObject(CompoundFkTestEntity.class);
        master.addToCompoundFkArray(detail);
        master.setName("m1");
        master.setKey1("key11");
        master.setKey2("key21");
        detail.setName("d1");

        ctxt.commitChanges();

        // reset context
        ctxt = createDataContext();

        SelectQuery q = new SelectQuery(CompoundPkTestEntity.class);
        List<?> objs = ctxt.performQuery(q);
        assertEquals(1, objs.size());

        master = (CompoundPkTestEntity) objs.get(0);
        assertEquals("m1", master.getName());

        List<?> details = master.getCompoundFkArray();
        assertEquals(1, details.size());
        detail = (CompoundFkTestEntity) details.get(0);

        assertEquals("d1", detail.getName());
    }
View Full Code Here

        assertEquals("d1", detail.getName());
    }

    public void testFetchQualifyingToOne() {
        CompoundPkTestEntity master = (CompoundPkTestEntity) ctxt
                .newObject("CompoundPkTestEntity");
        CompoundPkTestEntity master1 = (CompoundPkTestEntity) ctxt
                .newObject("CompoundPkTestEntity");
        CompoundFkTestEntity detail = (CompoundFkTestEntity) ctxt
                .newObject("CompoundFkTestEntity");
        CompoundFkTestEntity detail1 = (CompoundFkTestEntity) ctxt
                .newObject("CompoundFkTestEntity");
        master.addToCompoundFkArray(detail);
        master1.addToCompoundFkArray(detail1);

        master.setName("m1");
        master.setKey1("key11");
        master.setKey2("key21");

        master1.setName("m2");
        master1.setKey1("key12");
        master1.setKey2("key22");

        detail.setName("d1");

        detail1.setName("d2");
View Full Code Here

        detail = (CompoundFkTestEntity) objs.get(0);
        assertEquals("d1", detail.getName());
    }

    public void testFetchQualifyingToMany() throws Exception {
        CompoundPkTestEntity master = (CompoundPkTestEntity) ctxt
                .newObject("CompoundPkTestEntity");
        CompoundPkTestEntity master1 = (CompoundPkTestEntity) ctxt
                .newObject("CompoundPkTestEntity");
        CompoundFkTestEntity detail = (CompoundFkTestEntity) ctxt
                .newObject("CompoundFkTestEntity");
        CompoundFkTestEntity detail1 = (CompoundFkTestEntity) ctxt
                .newObject("CompoundFkTestEntity");
        master.addToCompoundFkArray(detail);
        master1.addToCompoundFkArray(detail1);

        master.setName("m1");
        master.setKey1("key11");
        master.setKey2("key21");

        master1.setName("m2");
        master1.setKey1("key12");
        master1.setKey2("key22");

        detail.setName("d1");

        detail1.setName("d2");
View Full Code Here

        ObjectContext context = createDataContext();
        Map<String, String> key1 = new HashMap<String, String>();
        key1.put(CompoundPkTestEntity.KEY1_PK_COLUMN, "b1");
        key1.put(CompoundPkTestEntity.KEY2_PK_COLUMN, "b2");
        CompoundPkTestEntity object = DataObjectUtils.objectForPK(
                context,
                CompoundPkTestEntity.class,
                key1);

        EJBQLQuery check = new EJBQLQuery(
View Full Code Here

    }

    public void testCompoundPkChangeSingleElement() throws Exception {
        DataContext context = createDataContext();

        CompoundPkTestEntity dao = context
                .newObject(CompoundPkTestEntity.class);
        CompoundPkTestEntity refreshedDao = null;

        dao.setKey1(key1v1);
        dao.setKey2(key2v1);
        dao.setName("testing testing");

        context.commitChanges();
        assertEquals(key1v1, dao.getObjectId().getIdSnapshot().get(
                CompoundPkTestEntity.KEY1_PK_COLUMN));
        assertEquals(key2v1, dao.getObjectId().getIdSnapshot().get(
                CompoundPkTestEntity.KEY2_PK_COLUMN));

        refreshedDao = (CompoundPkTestEntity) context.refetchObject(dao.getObjectId());
        assertEquals(dao.getObjectId(), refreshedDao.getObjectId());

        dao.setKey2(key2v2);

        context.commitChanges();
        assertEquals(key1v1, dao.getObjectId().getIdSnapshot().get(
                CompoundPkTestEntity.KEY1_PK_COLUMN));
        assertEquals(key2v2, dao.getObjectId().getIdSnapshot().get(
                CompoundPkTestEntity.KEY2_PK_COLUMN));

        refreshedDao = (CompoundPkTestEntity) context.refetchObject(dao.getObjectId());
        assertEquals(dao.getObjectId(), refreshedDao.getObjectId());

        dao.setKey2(key2v3);

        context.commitChanges();
        assertEquals(key1v1, dao.getObjectId().getIdSnapshot().get(
                CompoundPkTestEntity.KEY1_PK_COLUMN));
        assertEquals(key2v3, dao.getObjectId().getIdSnapshot().get(
                CompoundPkTestEntity.KEY2_PK_COLUMN));

        refreshedDao = (CompoundPkTestEntity) context.refetchObject(dao.getObjectId());
        assertEquals(dao.getObjectId(), refreshedDao.getObjectId());

    }
View Full Code Here

TOP

Related Classes of org.apache.art.CompoundPkTestEntity

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.