Examples of Master


Examples of org.apache.ojb.odmg.shared.Master

    }

    private Master populatedMasterFKnoPK(Transaction tx, int countDetailObjects, long timestamp)
            throws Exception
    {
        Master master = new Master();
        master.masterText = "Master_timestamp_" + timestamp;
        master.collDetailFKnoPK = new Vector();
        new Identity(master, ((HasBroker) tx).getBroker());
        for (int i = 0; i < countDetailObjects; i++)
        {
View Full Code Here

Examples of org.apache.ojb.odmg.shared.Master

    }

    private Master populatedMasterFKinPK(Transaction tx, int countDetailObjects, long timestamp)
            throws Exception
    {
        Master master = new Master();
        master.masterText = "Master_timestamp_" + timestamp;
        master.collDetailFKinPK = new Vector();
        new Identity(master, ((HasBroker) tx).getBroker());
        for (int i = 0; i < countDetailObjects; i++)
        {
View Full Code Here

Examples of org.apache.ojb.odmg.shared.Master

            // 2. Get a list of all Masters
            Transaction tx = odmg.newTransaction();
            tx.begin();
            // 1. Insert some objects into the database, some of them with
            // details in DetailFKinPK, some of them in DetailFKnoPK
            Master master_1 = populatedMasterFKinPK(tx, 7, timestamp);
            Master master_2 = populatedMasterFKinPK(tx, 6, timestamp);
            Master master_3 = populatedMasterFKnoPK(tx, 7, timestamp);
            Master master_4 = populatedMasterFKnoPK(tx, 6, timestamp);

            tx.lock(master_1, Transaction.WRITE);
            tx.lock(master_2, Transaction.WRITE);
            tx.lock(master_3, Transaction.WRITE);
            tx.lock(master_4, Transaction.WRITE);
            tx.commit();

            tx.begin();
            OQLQuery query = odmg.newOQLQuery();
            query.create("select masters from " + Master.class.getName() + " where masterText like $1");
            query.bind("%" + timestamp);
            DList allMasters = (DList) query.execute();

            // Iterator over all Master objects
            Iterator it = allMasters.iterator();
            int counter = 0;
            while (it.hasNext())
            {
                ++counter;
                Master aMaster = (Master) it.next();
                Iterator it2 = aMaster.collDetailFKinPK.iterator();
                while (it2.hasNext())
                    database.deletePersistent(it2.next());
                it2 = aMaster.collDetailFKnoPK.iterator();
                while (it2.hasNext())
View Full Code Here

Examples of org.apache.ojb.odmg.shared.Master

        long timestamp = System.currentTimeMillis();
        try
        {
            Transaction tx = odmg.newTransaction();
            tx.begin();
            Master master_1 = populatedMasterFKnoPK(tx, 5, timestamp);
            Master master_2 = populatedMasterFKnoPK(tx, 5, timestamp);

            database.makePersistent(master_1);
            database.makePersistent(master_2);
            tx.commit();

            // Check stored objects
            OQLQuery query = odmg.newOQLQuery();
            query.create("select masters from " + Master.class.getName() + " where masterText like $1");
            query.bind("%" + timestamp);
            DList allMasters = (DList) query.execute();
            assertEquals("We should found master objects", 2, allMasters.size());
            Master lookup_1 = (Master) allMasters.get(0);

            Collection col_in = lookup_1.getCollDetailFKinPK();
            Collection col_no = lookup_1.getCollDetailFKnoPK();
            assertEquals("Should found none " + DetailFKinPK.class.getName() + " objects", 0, col_in.size());
            assertEquals("Should found " + DetailFKnoPK.class.getName() + " objects", 5, col_no.size());
        }
        finally
        {
View Full Code Here

Examples of org.apache.ojb.odmg.shared.Master

        try
        {
            Transaction tx = odmg.newTransaction();
            tx.begin();

            Master master_1 = populatedMasterFKinPK(tx, 5, timestamp);
            Master master_2 = populatedMasterFKinPK(tx, 5, timestamp);

            database.makePersistent(master_1);
            database.makePersistent(master_2);
            tx.commit();

            // Check stored objects
            OQLQuery query = odmg.newOQLQuery();
            query.create("select masters from " + Master.class.getName() + " where masterText like $1");
            query.bind("%" + timestamp);
            DList allMasters = (DList) query.execute();
            assertEquals("We should found master objects", 2, allMasters.size());
            Master lookup_1 = (Master) allMasters.get(0);
            Collection col_in = lookup_1.getCollDetailFKinPK();
            Collection col_no = lookup_1.getCollDetailFKnoPK();
            assertEquals("Should found none " + DetailFKnoPK.class.getName() + " objects", 0, col_no.size());
            assertEquals("Should found " + DetailFKinPK.class.getName() + " objects", 5, col_in.size());
        }
        finally
        {
View Full Code Here

Examples of org.apache.ojb.odmg.shared.Master

    public void testStoreFKnoPK() throws Exception
    {
        long timestamp = System.currentTimeMillis();
        Transaction tx = odmg.newTransaction();
        tx.begin();
        Master master_1 = populatedMasterFKnoPK(tx, 5, timestamp);
        Master master_2 = populatedMasterFKnoPK(tx, 5, timestamp);

        database.makePersistent(master_1);
        database.makePersistent(master_2);
        tx.commit();

        // Check stored objects
        OQLQuery query = odmg.newOQLQuery();
        query.create("select masters from " + Master.class.getName() + " where masterText like $1");
        query.bind("%" + timestamp);
        List allMasters = (List) query.execute();
        assertEquals("We should found master objects", 2, allMasters.size());
        Master lookup_1 = (Master) allMasters.get(0);

        Collection col_in = lookup_1.getCollDetailFKinPK();
        Collection col_no = lookup_1.getCollDetailFKnoPK();
        assertEquals("Should found none " + DetailFKinPK.class.getName() + " objects", 0, col_in.size());
        assertEquals("Should found " + DetailFKnoPK.class.getName() + " objects", 5, col_no.size());
    }
View Full Code Here

Examples of org.apache.ojb.odmg.shared.Master

    {
        final long timestamp = System.currentTimeMillis();
        Transaction tx = odmg.newTransaction();
        tx.begin();

        Master master_1 = populatedMasterFKinPK(tx, 5, timestamp);
        Master master_2 = populatedMasterFKinPK(tx, 5, timestamp);

        database.makePersistent(master_1);
        database.makePersistent(master_2);
        tx.commit();

        // Check stored objects
        OQLQuery query = odmg.newOQLQuery();
        query.create("select masters from " + Master.class.getName() + " where masterText like $1");
        query.bind("%" + timestamp);
        List allMasters = (List) query.execute();
        assertEquals("We should found master objects", 2, allMasters.size());
        Master lookup_1 = (Master) allMasters.get(0);
        Collection col_in = lookup_1.getCollDetailFKinPK();
        Collection col_no = lookup_1.getCollDetailFKnoPK();
        assertEquals("Should found none " + DetailFKnoPK.class.getName() + " objects", 0, col_no.size());
        assertEquals("Should found " + DetailFKinPK.class.getName() + " objects", 5, col_in.size());
    }
View Full Code Here

Examples of org.apache.ojb.odmg.shared.Master

    }

    private Master populatedMasterFKnoPK(Transaction tx, int countDetailObjects, long timestamp)
            throws Exception
    {
        Master master = new Master();
        master.masterText = "Master_timestamp_" + timestamp;
        master.collDetailFKnoPK = new Vector();
        new Identity(master, ((HasBroker) tx).getBroker());
        for (int i = 0; i < countDetailObjects; i++)
        {
View Full Code Here

Examples of org.apache.ojb.odmg.shared.Master

    }

    private Master populatedMasterFKinPK(Transaction tx, int countDetailObjects, long timestamp)
            throws Exception
    {
        Master master = new Master();
        master.masterText = "Master_timestamp_" + timestamp;
        master.collDetailFKinPK = new Vector();
        new Identity(master, ((HasBroker) tx).getBroker());
        for (int i = 0; i < countDetailObjects; i++)
        {
View Full Code Here

Examples of org.apache.ojb.odmg.shared.Master

        // 2. Get a list of all Masters
        Transaction tx = odmg.newTransaction();
        tx.begin();
        // 1. Insert some objects into the database, some of them with
        // details in DetailFKinPK, some of them in DetailFKnoPK
        Master master_1 = populatedMasterFKinPK(tx, 7, timestamp);
        Master master_2 = populatedMasterFKinPK(tx, 6, timestamp);
        Master master_3 = populatedMasterFKnoPK(tx, 7, timestamp);
        Master master_4 = populatedMasterFKnoPK(tx, 6, timestamp);

        tx.lock(master_1, Transaction.WRITE);
        tx.lock(master_2, Transaction.WRITE);
        tx.lock(master_3, Transaction.WRITE);
        tx.lock(master_4, Transaction.WRITE);
        tx.commit();

        tx.begin();
        OQLQuery query = odmg.newOQLQuery();
        query.create("select masters from " + Master.class.getName() + " where masterText like $1");
        query.bind("%" + timestamp);
        List allMasters = (List) query.execute();

        // Iterator over all Master objects
        Iterator it = allMasters.iterator();
        int counter = 0;
        while (it.hasNext())
        {
            ++counter;
            Master aMaster = (Master) it.next();
            Iterator it2 = aMaster.collDetailFKinPK.iterator();
            while (it2.hasNext())
                database.deletePersistent(it2.next());
            it2 = aMaster.collDetailFKnoPK.iterator();
            while (it2.hasNext())
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.