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/java/org/apache/ojb/broker/accesslayer/sql SqlQueryStatement.java
Date Tue, 18 Mar 2003 19:56:27 GMT
brj         2003/03/18 11:56:27

  Modified:    src/java/org/apache/ojb/broker/accesslayer/sql
                        SqlQueryStatement.java
  Log:
  prevent adding extents having the same table as the base class
  fix by Ron Gallagher
  
  Revision  Changes    Path
  1.27      +17 -10    db-ojb/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java
  
  Index: SqlQueryStatement.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- SqlQueryStatement.java	10 Mar 2003 20:38:10 -0000	1.26
  +++ SqlQueryStatement.java	18 Mar 2003 19:56:26 -0000	1.27
  @@ -58,10 +58,9 @@
   import java.util.Collection;
   import java.util.Enumeration;
   import java.util.HashMap;
  -import java.util.HashSet;
   import java.util.Iterator;
   import java.util.List;
  -import java.util.Set;
  +import java.util.Map;
   
   import org.apache.ojb.broker.accesslayer.JoinSyntaxTypes;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
  @@ -1310,17 +1309,25 @@
               // BRJ : build alias for extents, only one per Table
   			if (lookForExtents)
   			{
  -				List ext = cld.getRepository().getConcreteSubclassesOf(cld.getClassOfObject());
  -				ClassDescriptor cd;
  -                Set extSet = new HashSet();  // only one Alias per Table
  +				List extClasses = cld.getRepository().getConcreteSubclassesOf(cld.getClassOfObject());
  +				ClassDescriptor extCd;
  +                String extTable;
  +                Map extMap = new HashMap();     // only one Alias per Table
   
  -				for (int i = 0; i < ext.size(); i++)
  +          		for (int i = 0; i < extClasses.size(); i++)
   				{
  -					cd = cld.getRepository().getDescriptorFor((Class) ext.get(i));
  -                    extSet.add(new TableAlias(cd, alias + "E" + i, false));           
     
  +					extCd = cld.getRepository().getDescriptorFor((Class) extClasses.get(i));
  +                    extTable = extCd.getFullTableName();
  +                    
  +                    // Add a new extent entry only if the table of the extent
  +                    // does not match the table of the 'base' class.
  +                    if (extMap.get(extTable) == null && !extTable.equals(table))
  
  +                    {
  +                        extMap.put(extTable, new TableAlias(extCd, alias + "E" + i, false));
  +                    }         
   				}
                   
  -                extents.addAll(extSet); 
  +                extents.addAll(extMap.values()); 
   			}
   		}
   
  
  
  

Mime
View raw message