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

        broker.beginTransaction();
        broker.store(samplePG);
        broker.commitTransaction();
        broker.clearCache();

        InterfaceProductGroup pg = (InterfaceProductGroup) broker.getObjectByQuery(new QueryByIdentity(samplePG));
        List list = pg.getAllArticles();
        assertNotNull(list);
        assertEquals(3, list.size());
        NumberRange range = new NumberRange(a1_.getArticleId(), a3_.getArticleId());
        InterfaceArticle a1 = null;
View Full Code Here

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

        {
            TransactionImpl tx = txManager.getCurrentTransaction();
            PersistenceBroker broker = tx.getBroker();

            NamedRootsEntry stored =
                    (NamedRootsEntry) broker.getObjectByQuery(new QueryByIdentity(entry));
            if (stored != null)
            {
                throw new ObjectNameNotUniqueException("object key already found, the key " + key + " is not unique");
            }
            else
View Full Code Here

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

        try
        {
            TransactionImpl tx = txManager.getCurrentTransaction();
            PersistenceBroker broker = tx.getBroker();
            NamedRootsEntry stored =
                    (NamedRootsEntry) broker.getObjectByQuery(new QueryByIdentity(example));
            if (stored == null)
            {
                throw new ObjectNameNotFoundException("Could not find a bound object for key " + key);
            }
            else
View Full Code Here

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

        // 1. build an example object with matching primary key values:
        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

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

        // we do this by a query by example (QBE):
        // 1. build an example object with matching primary key values:
        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();
            // lookup the product specified by the QBE
View Full Code Here

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

        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

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

        {
            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
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.