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 Mon, 24 Feb 2003 19:03:34 GMT
brj         2003/02/24 11:03:34

  Modified:    src/java/org/apache/ojb/broker/accesslayer/sql
                        SqlQueryStatement.java
  Log:
  prevent multipleTableAliases for same Table
  
  Revision  Changes    Path
  1.23      +10 -15    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.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- SqlQueryStatement.java	20 Feb 2003 21:17:59 -0000	1.22
  +++ SqlQueryStatement.java	24 Feb 2003 19:03:34 -0000	1.23
  @@ -58,8 +58,10 @@
   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 org.apache.ojb.broker.accesslayer.JoinSyntaxTypes;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
  @@ -1179,17 +1181,20 @@
   			this.table = cld.getFullTableName();
   			this.alias = alias;
   
  -            // BRJ : build alias for extents
  +            // 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
   
   				for (int i = 0; i < ext.size(); i++)
   				{
   					cd = cld.getRepository().getDescriptorFor((Class) ext.get(i));
  -					extents.add(new TableAlias(cd, alias + "E" + i, false));
  +                    extSet.add(new TableAlias(cd, alias + "E" + i, false));           
     
   				}
  +                
  +                extents.addAll(extSet); 
   			}
   		}
   
  @@ -1267,22 +1272,12 @@
           {
               TableAlias t = (TableAlias) obj;
   
  -            if (!alias.equals(t.alias))
  -            {
  -                return false;
  -            }
  -
  -            if (joins == null)
  -            {
  -                return (t.joins != null);
  -            }
  -
  -            return joins.equals(t.joins);
  +            return table.equals(t.table);       // BRJ: check table only
           }
   
           public int hashCode()
           {
  -            return alias.hashCode();
  +            return table.hashCode();
           }
   
           public Object clone()
  
  
  

Mime
View raw message