Package org.apache.ojb.broker

Examples of org.apache.ojb.broker.Fish


    {
        ODMGGourmet paula = new ODMGGourmet("a_testMtoNSeparate_I");
        ODMGGourmet candy = new ODMGGourmet("b_testMtoNSeparate_I");

        long timestamp = System.currentTimeMillis();
        Fish tuna = new Fish("tuna_" + timestamp, 242, "salt");
        Fish trout = new Fish("trout_" + timestamp, 52, "fresh water");

        paula.addFavoriteFood(trout);
        candy.addFavoriteFood(tuna);

        TransactionExt tx = (TransactionExt) odmg.newTransaction();
        tx.begin();
        database.makePersistent(paula);
        database.makePersistent(candy);
        tx.commit();

        OQLQuery query = odmg.newOQLQuery();
        query.create("select fishs from " + Fish.class.getName() +
                " where (name=$1 or name=$2)");
        query.bind(tuna.getName());
        query.bind(trout.getName());
        List fishs = (List) query.execute();
        /*
        we expect 2 created 'fish'
        */
        assertEquals(2, fishs.size());
View Full Code Here


    {
        ODMGGourmet james = new ODMGGourmet("a_testMtoNSeparate_II");
        ODMGGourmet doris = new ODMGGourmet("b_testMtoNSeparate_II");

        long timestamp = System.currentTimeMillis();
        Fish tuna = new Fish("tuna_" + timestamp, 242, "salt");
        Fish trout = new Fish("trout_" + timestamp, 52, "fresh water");

        james.addFavoriteFood(tuna);

        doris.addFavoriteFood(tuna);
        doris.addFavoriteFood(trout);

        TransactionExt tx = (TransactionExt) odmg.newTransaction();
        tx.begin();
        database.makePersistent(james);
        database.makePersistent(doris);
        tx.commit();

        OQLQuery query = odmg.newOQLQuery();
        query.create("select fishs from " + Fish.class.getName() +
                " where (name=$1 or name=$2)");
        query.bind(tuna.getName());
        query.bind(trout.getName());
        List fishs = (List) query.execute();
        /*
        we expect 2 created 'fish'
        */
        assertEquals(2, fishs.size());
View Full Code Here

TOP

Related Classes of org.apache.ojb.broker.Fish

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.