db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clóvis Wichoski <clovis_wicho...@uol.com.br>
Subject Re: BUG: on path expression for multiple joined table (diff Patch inside)
Date Sat, 03 Jul 2004 12:07:34 GMT
hi Jakob,

Sorry, I'm starting to contribute ;)


Index: src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java
===================================================================
RCS file: 
/home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java,v
retrieving revision 1.75
diff -u -r1.75 SqlQueryStatement.java
--- 
src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java    
22 May 2004 09:51:25 -0000    1.75
+++ 
src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java    
3 Jul 2004 12:02:19 -0000
@@ -836,18 +836,30 @@
 
             if (hasExtents)
             {
+                /** 
+                * CW : If used multiple table joins the only way to 
know Extends to Bind is after the loop
+                *      or better solution for this maybe computed on 
Metadata discover?
+                **/
+                int nExtendsToBind = 0;
+               
                 // BRJ : surround with braces if alias has extents
                 buf.append("(");
                 appendCriteria(alias, attrInfo.pathInfo, c, buf);
-
-                c.setNumberOfExtentsToBind(alias.extents.size());
+               
                 Iterator iter = alias.iterateExtents();
                 while (iter.hasNext())
                 {
                     TableAlias tableAlias = (TableAlias) iter.next();
-                    buf.append(" OR ");
-                    appendCriteria(tableAlias, attrInfo.pathInfo, c, buf);
+                   
+                    // CW : only if multiple joined tables redeclared 
superclass field
+                    if 
(tableAlias.getClassDescriptor().getFieldDescriptorByName(attrInfo.pathInfo.column) 
!= null)
+                    {
+                        nExtendsToBind++;
+                        buf.append(" OR ");
+                        appendCriteria(tableAlias, attrInfo.pathInfo, 
c, buf);
+                    }
                 }
+                c.setNumberOfExtentsToBind(nExtendsToBind);
                 buf.append(")");
             }
             else


Jakob Braeuchi wrote:

> hi clovis,
>
> the patch cannot be applied in eclipse. imo you have to use diff -u ...
>
> jakob
>
> Jakob Braeuchi wrote:
>



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message