Package org.apache.ojb.broker

Examples of org.apache.ojb.broker.InterfaceProductGroup


         */
        OQLQuery query = odmg.newOQLQuery();
        query.create("select productGroup from " + ProductGroup.class.getName());
        Collection results = (Collection) query.execute();
        Iterator it = results.iterator();
        InterfaceProductGroup temp = null;
        /**
         * to each productgroup add an article with a pre-determined name.
         */

        int i = 2300;
        while (it.hasNext())
        {
            Article article = createArticle(i++);
            article.setArticleName("OneToManyUpdateTest");
            temp = (InterfaceProductGroup) it.next();
            tx.lock(temp, Transaction.WRITE);
            temp.add(article);
            article.setProductGroup(temp);
        }
        tx.commit(); // thma: during this commit no article is persisted! works as designed!

        /**
         * 2. requery and find the articles we added.
         */
        query = odmg.newOQLQuery();
        query.create("select productGroup from " + ProductGroup.class.getName());
        results = (Collection) query.execute();
        it = results.iterator();
        temp = null;
        boolean found = false;
        while (it.hasNext())
        {
            found = false;
            temp = (InterfaceProductGroup) it.next();
            Collection articles = temp.getAllArticles();
            Iterator it2 = articles.iterator();
            while (it2.hasNext())
            {
                InterfaceArticle art = (InterfaceArticle) it2.next();
                if (art.getArticleName() != null)
View Full Code Here


        query.bind(name);
        Collection results = (Collection) query.execute();
        tx.commit();
        Iterator it = results.iterator();
        assertTrue(it.hasNext());
        InterfaceProductGroup pg = (InterfaceProductGroup) it.next();
        assertFalse(it.hasNext());
        assertNotNull(pg.getAllArticles());
        assertEquals(COUNT, pg.getAllArticles().size());
    }
View Full Code Here

        query.create("select productGroup from " + ProductGroup.class.getName() + " where groupName like $1");
        query.bind(name + "%");
        Collection results = (Collection) query.execute();
        assertEquals(2, results.size());
        Iterator it = results.iterator();
        InterfaceProductGroup temp = null;
        /**
         * to each productgroup add an article with a pre-determined name.
         */
        while (it.hasNext())
        {
            Article article = createArticle(name);
            temp = (InterfaceProductGroup) it.next();
            tx.lock(temp, Transaction.WRITE);
            temp.add(article);
            article.setProductGroup(temp);
        }
        tx.commit();

        /**
         * 2. requery and find the articles we added.
         */
        tx.begin();
        query = odmg.newOQLQuery();
        query.create("select productGroup from " + ProductGroup.class.getName() + " where groupName like $1");
        query.bind(name + "%");
        results = (Collection) query.execute();
        tx.commit();

        assertEquals(2, results.size());
        it = results.iterator();
        int counter = 0;
        temp = null;
        while (it.hasNext())
        {
            temp = (InterfaceProductGroup) it.next();
            Collection articles = temp.getAllArticles();
            counter = counter + articles.size();
            Iterator it2 = articles.iterator();
            while (it2.hasNext())
            {
                InterfaceArticle art = (InterfaceArticle) it2.next();
View Full Code Here

    Iterator iter = myPB.getIteratorByQuery(qry);
    assertStmtCount("getIteratorByQuery", 1);
    while (iter.hasNext())
    {
      resetStmtCount();
      InterfaceProductGroup next = (InterfaceProductGroup) iter.next();
      assertStmtCount("next", 0);
      List articles = next.getAllArticles();
      // SELECT ... FROM Kategorien
      // SELECT ... FROM Artikel
      // SELECT ... FROM BOOKS
      // SELECT ... FROM CDS
      assertStmtCount("getAllArticles", 4);
View Full Code Here

        query.bind(name);
        Collection results = (Collection) query.execute();
        tx.commit();
        Iterator it = results.iterator();
        assertTrue(it.hasNext());
        InterfaceProductGroup pg = (InterfaceProductGroup) it.next();
        assertFalse(it.hasNext());
        assertNotNull(pg.getAllArticles());
        assertEquals(COUNT, pg.getAllArticles().size());
    }
View Full Code Here

        query.create("select productGroup from " + ProductGroup.class.getName() + " where groupName like $1");
        query.bind(name + "%");
        Collection results = (Collection) query.execute();
        assertEquals(2, results.size());
        Iterator it = results.iterator();
        InterfaceProductGroup temp = null;
        /**
         * to each productgroup add an article with a pre-determined name.
         */
        while (it.hasNext())
        {
            Article article = createArticle(name);
            temp = (InterfaceProductGroup) it.next();
            tx.lock(temp, Transaction.WRITE);
            temp.add(article);
            article.setProductGroup(temp);
        }
        tx.commit();

        /**
         * 2. requery and find the articles we added.
         */
        tx.begin();
        query = odmg.newOQLQuery();
        query.create("select productGroup from " + ProductGroup.class.getName() + " where groupName like $1");
        query.bind(name + "%");
        results = (Collection) query.execute();
        tx.commit();

        assertEquals(2, results.size());
        it = results.iterator();
        int counter = 0;
        temp = null;
        while (it.hasNext())
        {
            temp = (InterfaceProductGroup) it.next();
            Collection articles = temp.getAllArticles();
            counter = counter + articles.size();
            Iterator it2 = articles.iterator();
            while (it2.hasNext())
            {
                InterfaceArticle art = (InterfaceArticle) it2.next();
View Full Code Here

    Iterator iter = myPB.getIteratorByQuery(qry);
    assertStmtCount("getIteratorByQuery", 1);
    while (iter.hasNext())
    {
      resetStmtCount();
      InterfaceProductGroup next = (InterfaceProductGroup) iter.next();
      assertStmtCount("next", 0);
      List articles = next.getAllArticles();
      // SELECT ... FROM Kategorien
      // SELECT ... FROM Artikel
      // SELECT ... FROM BOOKS
      // SELECT ... FROM CDS
      assertStmtCount("getAllArticles", 4);
View Full Code Here

TOP

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

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.