Package org.apache.ojb.odmg.shared

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


    private void newSite(Implementation odmg, String name, int year, int semester) throws Exception
    {
        Transaction tx = null;
        tx = odmg.newTransaction();
        Site site = null;
        tx.begin();

        site = new Site();
        site.setName(name);
        site.setYear(new Integer(year));
        site.setSemester(new Integer(semester));

        tx.lock(site, Transaction.WRITE);
        tx.commit();
    }
View Full Code Here


        Implementation odmg = OJB.getInstance();
        Database db = odmg.newDatabase();
        String name = "testSimpleQueryDelete - " + System.currentTimeMillis();

        db.open(databaseName, Database.OPEN_READ_WRITE);
        Site site = new Site();
        site.setName(name);
        Transaction tx = odmg.newTransaction();
        tx.begin();
        tx.lock(site, Transaction.WRITE);
        tx.commit();
View Full Code Here

            String name = "testImplicitLocking - " + System.currentTimeMillis();
            String queryString = "select sites from " + Site.class.getName() + " where name = $1";

            /* Create an object */
            Site site = new Site();
            site.setName(name);

            Transaction tx = odmg.newTransaction();
            tx.begin();
            tx.lock(site, Transaction.WRITE);
            tx.commit();

            /* Retrieve from the object created, and set the year*/
            OQLQuery query = odmg.newOQLQuery();
            query.create(queryString);
            query.bind(name);

            tx.begin();
            List result = (List) query.execute();
            assertEquals(1, result.size());
            site = (Site) result.get(0);
            assertNotNull(site);
            assertNull(site.getYear());
            tx.lock(site, Transaction.UPGRADE);
            site.setYear(new Integer(2003));

            tx.commit();

            /* Flush the cache, and retrieve the object again */
            query = odmg.newOQLQuery();
            query.create(queryString);
            query.bind(name);
            tx.begin();
            ((HasBroker) tx).getBroker().clearCache();
            result = (List) query.execute();
            assertEquals(1, result.size());
            site = (Site) result.get(0);
            assertNotNull(site);
            assertNotNull("year should not be null", site.getYear());
            tx.commit();

            db.close();
        }
        finally
View Full Code Here

    private void newSite(Implementation odmg, String name, int year, int semester) throws Exception
    {
        Transaction tx = null;
        tx = odmg.newTransaction();
        Site site = null;
        tx.begin();

        site = new Site();
        site.setName(name);
        site.setYear(new Integer(year));
        site.setSemester(new Integer(semester));

        tx.lock(site, Transaction.WRITE);
        tx.commit();
    }
View Full Code Here

    public void testSimpleQueryDelete() throws Exception
    {
        String name = "testSimpleQueryDelete - " + System.currentTimeMillis();

        Site site = new Site();
        site.setName(name);
        Transaction tx = odmg.newTransaction();
        tx.begin();
        tx.lock(site, Transaction.WRITE);
        tx.commit();
View Full Code Here

    {
        String name = "testImplicitLocking - " + System.currentTimeMillis();
        String queryString = "select sites from " + Site.class.getName() + " where name = $1";

        /* Create an object */
        Site site = new Site();
        site.setName(name);

        TransactionExt tx = (TransactionExt) odmg.newTransaction();
        // disable implicit locking for this tx instance
        // this setting was used for the life-time of the tx instance
        tx.setImplicitLocking(false);
        tx.begin();
        database.makePersistent(site);
        tx.commit();

        /* Retrieve from the object created, and set the year*/
        OQLQuery query = odmg.newOQLQuery();
        query.create(queryString);
        query.bind(name);

        tx.begin();
        List result = (List) query.execute();
        assertEquals(1, result.size());
        site = (Site) result.get(0);
        assertNotNull(site);
        assertNull(site.getYear());
        tx.lock(site, Transaction.WRITE);
        site.setYear(new Integer(2003));
        tx.commit();

        /* Flush the cache, and retrieve the object again */
        query = odmg.newOQLQuery();
        query.create(queryString);
        query.bind(name);
        tx.begin();
        tx.getBroker().clearCache();
        result = (List) query.execute();
        assertEquals(1, result.size());
        site = (Site) result.get(0);
        assertNotNull(site);
        assertNotNull("year should not be null", site.getYear());
        tx.commit();
    }
View Full Code Here

    private void newSite(Implementation odmg, String name, int year, int semester) throws Exception
    {
        Transaction tx = null;
        tx = odmg.newTransaction();
        Site site = null;
        tx.begin();

        site = new Site();
        site.setName(name);
        site.setYear(new Integer(year));
        site.setSemester(new Integer(semester));

        tx.lock(site, Transaction.WRITE);
        tx.commit();
    }
View Full Code Here

        Implementation odmg = OJB.getInstance();
        Database db = odmg.newDatabase();
        String name = "testSimpleQueryDelete - " + System.currentTimeMillis();

        db.open(databaseName, Database.OPEN_READ_WRITE);
        Site site = new Site();
        site.setName(name);
        Transaction tx = odmg.newTransaction();
        tx.begin();
        tx.lock(site, Transaction.WRITE);
        tx.commit();
View Full Code Here

            String name = "testImplicitLocking - " + System.currentTimeMillis();
            String queryString = "select sites from " + Site.class.getName() + " where name = $1";

            /* Create an object */
            Site site = new Site();
            site.setName(name);

            Transaction tx = odmg.newTransaction();
            tx.begin();
            tx.lock(site, Transaction.WRITE);
            tx.commit();

            /* Retrieve from the object created, and set the year*/
            OQLQuery query = odmg.newOQLQuery();
            query.create(queryString);
            query.bind(name);

            tx.begin();
            List result = (List) query.execute();
            assertEquals(1, result.size());
            site = (Site) result.get(0);
            assertNotNull(site);
            assertNull(site.getYear());
            tx.lock(site, Transaction.WRITE);
            site.setYear(new Integer(2003));

            tx.commit();

            /* Flush the cache, and retrieve the object again */
            query = odmg.newOQLQuery();
            query.create(queryString);
            query.bind(name);
            tx.begin();
            ((HasBroker) tx).getBroker().clearCache();
            result = (List) query.execute();
            assertEquals(1, result.size());
            site = (Site) result.get(0);
            assertNotNull(site);
            assertNotNull("year should not be null", site.getYear());
            tx.commit();

            db.close();
        }
        finally
View Full Code Here

TOP

Related Classes of org.apache.ojb.odmg.shared.Site

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.