Examples of QueryByIdentity


Examples of org.apache.ojb.broker.query.QueryByIdentity

        else
        {
            // if query is Identity based transform it to a criteria based query first
            if (query instanceof QueryByIdentity)
            {
                QueryByIdentity qbi = (QueryByIdentity) query;
                Object oid = qbi.getExampleObject();
                // make sure it's an Identity
                if (!(oid instanceof Identity))
                {
                    oid = new Identity(oid, this);
                }
View Full Code Here

Examples of org.apache.ojb.broker.query.QueryByIdentity

        tx.abort();

        tx = (TransactionExt) odmg.newTransaction();
        tx.begin();
        broker = tx.getBroker();
        QueryByIdentity query2 = new QueryByIdentity(obj);
        Object result = broker.getObjectByQuery(query2);
        tx.commit();

        assertNull("We should not find objects from aborted tx", result);
    }
View Full Code Here

Examples of org.apache.ojb.broker.query.QueryByIdentity

        tx.abort();

        tx = (TransactionExt) odmg.newTransaction();
        tx.begin();
        broker = tx.getBroker();
        QueryByIdentity query2 = new QueryByIdentity(obj);
        Object result = broker.getObjectByQuery(query2);
        tx.commit();

        assertNull("We should not find objects from aborted tx", result);
    }
View Full Code Here

Examples of org.apache.ojb.broker.query.QueryByIdentity

        else
        {
            // if query is Identity based transform it to a criteria based query first
            if (query instanceof QueryByIdentity)
            {
                QueryByIdentity qbi = (QueryByIdentity) query;
                Object oid = qbi.getExampleObject();
                // make sure it's an Identity
                if (!(oid instanceof Identity))
                {
                    oid = new Identity(oid, this);
                }
View Full Code Here

Examples of org.apache.ojb.broker.query.QueryByIdentity

        Product result  = null;

        example.setId(id);

        // 2. build a QueryByIdentity from this sample instance:
        Query             query  = new QueryByIdentity(example);
        PersistenceBroker broker = null;

        try
        {
            // 3. get a broker and lookup the product specified by the QBE
View Full Code Here

Examples of org.apache.ojb.broker.query.QueryByIdentity

        Product example = new Product();

        example.setId(id);

        // 2. build a QueryByIdentity from this sample instance:
        Query             query  = new QueryByIdentity(example);
        PersistenceBroker broker = null;

        try
        {
            // 3. get a broker
View Full Code Here

Examples of org.apache.ojb.broker.query.QueryByIdentity

        GUID guid = new GUID();

        PersistenceBroker broker1 = PersistenceBrokerFactory.defaultPersistenceBroker();
        broker1.beginTransaction();

        Article a1 = (Article) broker1.getObjectByQuery(new QueryByIdentity(oid));
        String originalName = a1.getArticleName();
        a1.setArticleName(guid.toString());

// start a second transaction
        PersistenceBroker broker2 = PersistenceBrokerFactory.defaultPersistenceBroker();
        broker2.beginTransaction();

        Article a2 = (Article) broker2.getObjectByQuery(new QueryByIdentity(oid));

        assertEquals(guid.toString(), a1.getArticleName());
        assertEquals(originalName, a2.getArticleName());
        assertNotSame(a1, a2);
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.