Package org.apache.ojb.broker.query

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);

        try
        {
            // 3. start broker transaction
            broker.beginTransaction();
View Full Code Here


        Product example = new Product();

        example.setId(id);

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

        try
        {
            // start broker transaction
            broker.beginTransaction();
View Full Code Here

        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

        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

        Product example = new Product();

        example.setId(id);

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

        try
        {
            // 3. start broker transaction
            broker.beginTransaction();
View Full Code Here

        Product example = new Product();

        example.setId(id);

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

        try
        {
            // start broker transaction
            broker.beginTransaction();
View Full Code Here

        for (i = 1; i < 4; i++)
        {
            ProductGroupWithArray example = new ProductGroupWithArray();
            example.setId(i);
            ProductGroupWithArray group =
                (ProductGroupWithArray) broker.getObjectByQuery(new QueryByIdentity(example));
            assertEquals("should be equal", i, group.getId());
            //System.out.println(group + "\n\n");

            broker.delete(group);
            broker.store(group);
View Full Code Here

        {
            ProductGroupWithTypedCollection example = new ProductGroupWithTypedCollection();
            example.setId(i);
            ProductGroupWithTypedCollection group =
                (ProductGroupWithTypedCollection) broker.getObjectByQuery(
                    new QueryByIdentity(example));
            assertEquals("should be equal", i, group.getId());
            //System.out.println(group + "\n\n");

            broker.delete(group);
            broker.store(group);
View Full Code Here

        broker.commitTransaction();
        broker.clearCache();
        Article cached =
                (Article) broker.serviceObjectCache().lookup(tmpOID);
        assertNull("After flushing Object should be not in cache", cached);
        Article article = (Article) broker.getObjectByQuery(new QueryByIdentity(tmpOID));
        cached = (Article) broker.serviceObjectCache().lookup(tmpOID);
        assertNotNull("now object should be found in cache", cached);
        assertEquals("should be the same Identity", new Identity(cached, broker), new Identity(article,broker));
        assertEquals("objects should have identical values", cached.toString(), article.toString());
    }
View Full Code Here

        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

TOP

Related Classes of org.apache.ojb.broker.query.QueryByIdentity

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.