Post your patch to http://sourceforge.net/tracker/?group_id=22866
under the Patches section.

----- Original Message ----- 
From: "Vinay Menon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 26, 2001 4:24 PM
Subject: [JBoss-user] Followup - Joins - CMP Entity Beans - BUG????


> Alright folks,
>     Here is the modified code. It works a treat!
> 
>       if (query.toLowerCase().startsWith(",")) {
>           //Modified by Vinay Menon
>           StringBuffer sqlBuffer = new StringBuffer();
> 
>         sqlBuffer.append("SELECT ");
> 
>           String primaryKeyList = getPkColumnList();
>           String tableName = jawsEntity.getTableName();
>           StringTokenizer stok = new StringTokenizer(primaryKeyList,",");
> 
>           while(stok.hasMoreTokens()){
>             sqlBuffer.append(tableName);
>             sqlBuffer.append(".");
>             sqlBuffer.append(stok.nextElement().toString());
>             sqlBuffer.append(",");
>           }
> 
>          sqlBuffer.setLength(sqlBuffer.length()-1);
>          sqlBuffer.append(strippedOrder);
>          sqlBuffer.append(" FROM ");
>          sqlBuffer.append(jawsEntity.getTableName());
>          sqlBuffer.append(" ");
>          sqlBuffer.append(query);
> 
>          sql = sqlBuffer.toString();
>          //sql += strippedOrder +" FROM " + jawsEntity.getTableName() + " " 
> + query;
>       } else
> 
> 
> 
>      Will take the trouble to actually modify the rest later! But if anyone 
> wants to do it  please do. Also, if the code owners at jboss.org happen to 
> see this - can you please ensure that a fix is in place for the next interim 
> release??? - it would really help. I have currently rebuilt the source and 
> am working off it.
> 
> Regards
> 
> Vinay
> 
> Hi Again,
>     Believe I have figured where the issue lies. The sql is constructed by 
> org.jboss.ejb.plugins.jaws.jdbc.JDBCDefinedFinderCommand in the statement
> 
>      if (query.toLowerCase().startsWith(",")) {
>         sql = "SELECT " + jawsEntity.getTableName()+"."+getPkColumnList() + 
> strippedOrder +
>         " FROM " + jawsEntity.getTableName() + " " + query;
> 
> 
>       Obviously, if getPkColumnList has multiple items, the table name would 
> not be pre-pended!  Believe this is where the issue lies. Will try fixing 
> this and recompiling the source. Might have to wait unitl tomorrow though 
> cos its midnight!
> 
> Regards,
> 
> Vinay
> 
> 
> 
> Hi,
>    Following the example provided in the online documentation I've tried 
> getting the join working across 2 tables.
> 
> The table structures are
> 
> Table A
> Col1,Col2,Col3
> 
> Table B
> Col1,Col2,Col4
> 
> Col1 and Col2 form the primary key for both the tables.
> 
> The finder definition is
> 
>       <finder>
>         <name>findForXXByYYZZ</name>
>         <query>,B
>                WHERE B.Col1 = A.Col1
>                AND B.Col2= A.Col2
>                AND A.Col2= {0}
>                AND A.Col1 = {1}
>         </query>
>         <order></order></finder>
> The sql that I'd wanted the finder to produce was
> 
> SELECT A.Col1, A.Col2
> FROM  A,B
> WHERE B.Col1 =  A.Col1
> AND B.Col2=  A.Col2
> AND A.Col2= {0}
> AND A.Col1 = {1}
> 
>    The sql produced, however, seems to be
> 
> SELECT A.Col1, Col2
> FROM  A,B
> WHERE B.Col1 =  A.Col1
> AND B.Col2 =  A.Col2
> AND A.Col2= {0}
> AND A.Col1 = {1}
> 
>     Now Col2 is an ambiguous column and the query, obviously would fail.
> 
> Has anyone come across this and found a work around? Is anyone on the JBoss 
> Developers list working towards fixing this?
> 
> Please do let me know
> 
> Kind Regards
> 
> Vinay Menon
> 
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
> 
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
> 


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to