db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb/odmg OQLOrOnForeignKeyTest.java
Date Thu, 06 Feb 2003 20:44:52 GMT
brj         2003/02/06 12:44:52

  Modified:    src/test/org/apache/ojb/odmg OQLOrOnForeignKeyTest.java
  Log:
  enhanced testcase for same table
  
  Revision  Changes    Path
  1.6       +19 -4     db-ojb/src/test/org/apache/ojb/odmg/OQLOrOnForeignKeyTest.java
  
  Index: OQLOrOnForeignKeyTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/OQLOrOnForeignKeyTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- OQLOrOnForeignKeyTest.java	6 Feb 2003 18:15:23 -0000	1.5
  +++ OQLOrOnForeignKeyTest.java	6 Feb 2003 20:44:52 -0000	1.6
  @@ -152,7 +152,7 @@
   	}
   
       /**
  -     * fails because ojb generated INNER JOIN where LEFT OUTER JOINS is needed
  +     * test joins on same table
        * 
        * @throws Exception
        */
  @@ -166,7 +166,9 @@
   		PersonImpl joe = new PersonImpl();
   		PersonImpl father = new PersonImpl();
   		PersonImpl mother = new PersonImpl();
  -
  +        OQLQuery query;
  +        List persons;
  +        
   		mother.setId(motherID);
   		father.setId(fatherID);
   		mother.setFirstname("mom");
  @@ -193,16 +195,29 @@
   		db.makePersistent(joe);
   		tx.commit();
   
  +        // read using id
   		tx = odmg.newTransaction();
   		tx.begin();
  -		OQLQuery query = odmg.newOQLQuery();
  +		query = odmg.newOQLQuery();
   		query.create("select person from " + PersonImpl.class.getName() +
   					 " where (mother.id=$1 or father.id=$2)");
   		query.bind(new Integer(motherID));
   		query.bind(new Integer(fatherID));
  -		List persons = (List) query.execute();
  +		persons = (List) query.execute();
           assertEquals(2, persons.size());
   		tx.commit();
  +
  +        // read using firstname
  +        tx = odmg.newTransaction();
  +        tx.begin();
  +        query = odmg.newOQLQuery();
  +        query.create("select person from " + PersonImpl.class.getName() +
  +                     " where (mother.firstname=$1 or father.firstname=$2)");
  +        query.bind("mom");
  +        query.bind("dad");
  +        persons = (List) query.execute();
  +        assertEquals(2, persons.size());
  +        tx.commit();
   
   
   	}
  
  
  

Mime
View raw message