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/broker MtoNMapping.java
Date Thu, 22 May 2003 20:35:12 GMT
brj         2003/05/22 13:35:12

  Modified:    src/test/org/apache/ojb/broker MtoNMapping.java
  Log:
  new testcase to check m:n with user alias
  
  Revision  Changes    Path
  1.11      +23 -0     db-ojb/src/test/org/apache/ojb/broker/MtoNMapping.java
  
  Index: MtoNMapping.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/MtoNMapping.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- MtoNMapping.java	2 Apr 2003 21:07:11 -0000	1.10
  +++ MtoNMapping.java	22 May 2003 20:35:12 -0000	1.11
  @@ -9,6 +9,7 @@
   
   import org.apache.ojb.broker.query.Criteria;
   import org.apache.ojb.broker.query.Query;
  +import org.apache.ojb.broker.query.QueryByCriteria;
   import org.apache.ojb.broker.query.QueryFactory;
   
   /** This TestClass tests OJB facilities to work with polymorphism.
  @@ -229,6 +230,28 @@
           q = QueryFactory.newQuery(Project.class, c);
           Collection col = broker.getCollectionByQuery(q);
           assertNotNull(col);
  +    }
  +
  +    /** test m:n loading using alias */
  +    public void testMNLoadingAlias() throws Exception
  +    {
  +        Criteria crit1 = new Criteria();
  +        Criteria crit2 = new Criteria();
  +        QueryByCriteria q;
  +        Collection result;
  +        
  +        broker.clearCache();
  +
  +        crit1.addLike("projects.title","OJB%");   
  +        crit1.setAlias("alias1");    
  +        crit2.addLike("projects.title","SODA%");       
  +        crit2.setAlias("alias2");
  +        crit1.addAndCriteria(crit2);
  +            
  +        q = QueryFactory.newQuery(Person.class, crit1,true);
  +        result = broker.getCollectionByQuery(q);
  +        assertNotNull(result);
  +        assertTrue(result.size() == 2);
       }
   
       /** test loading of m:n unidirectionally mapped objects*/
  
  
  

Mime
View raw message