You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Sander Hofstee <sa...@topicus.nl> on 2003/01/31 16:49:33 UTC
I think this is the CORRECT fix Re: Column: 'id' in where clause
is ambiguous
Thanks for the fix, but I think there still was a problem with it.
It should call addEqualToField instead of addEqualToColumn because we want to have column == value and NOT column == column
I think the code below is the correct fix.
Index: PersistenceBrokerImpl.java
===================================================================
RCS file: /home/cvspublic/jakarta-ojb/src/java/org/apache/ojb/broker/singlevm/PersistenceBrokerImpl.java,v
retrieving revision 1.118
diff -u -r1.118 PersistenceBrokerImpl.java
--- PersistenceBrokerImpl.java 30 Jan 2003 15:16:51 -0000 1.118
+++ PersistenceBrokerImpl.java 31 Jan 2003 12:48:10 -0000
@@ -2018,7 +2018,7 @@
}
for (int i = 0; i < itemClassFks.length; i++)
{
- criteria.addEqualToColumn(
+ criteria.addEqualToField(
cod.getIndirectionTable() + "." + itemClassFks[i].toString(),
refCld.getPkFields()[i].getAttributeName());
}
Igor.Petrenko@adminteractive.com.ua wrote:
>Index: PersistenceBrokerImpl.java
>===================================================================
>RCS file: /home/cvspublic/jakarta-ojb/src/java/org/apache/ojb/broker/singlevm/PersistenceBrokerImpl.java,v
>retrieving revision 1.117
>diff -r1.117 PersistenceBrokerImpl.java
>2022,2023c2022,2023
>< cod.getIndirectionTable() + "." + itemClassFks[i].toString(),
>< refCld.getPkFields()[i].getAttributeName());
>---
>
>
>> refCld.getPkFields()[i].getAttributeName()),
>> cod.getIndirectionTable() + "." + itemClassFks[i].toString());
>>
>>
>
>
>-----Original Message-----
>From: Sander Hofstee [mailto:sander.hofstee@topicus.nl]
>Sent: Thursday, January 30, 2003 5:10 PM
>To: OJB Developers List
>Subject: Column: 'id' in where clause is ambiguous
>
>
>Sorry, put it in the wrong thread.
>
>I downloaded the latest CVS version of ojb and tried to make this work.
>But when I try to load an object with an indirection table I get an error:
>General error: Column: 'id' in where clause is ambiguous
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: ojb-dev-help@jakarta.apache.org
>
>
>
Re: I think this is the CORRECT fix Re: Column: 'id' in where clause
is ambiguous
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi sander,
i fixed it.
thanks
jakob
Sander Hofstee wrote:
> Thanks for the fix, but I think there still was a problem with it.
>
> It should call addEqualToField instead of addEqualToColumn because we
> want to have column == value and NOT column == column
> I think the code below is the correct fix.
>
> Index: PersistenceBrokerImpl.java
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-ojb/src/java/org/apache/ojb/broker/singlevm/PersistenceBrokerImpl.java,v
> retrieving revision 1.118
> diff -u -r1.118 PersistenceBrokerImpl.java
> --- PersistenceBrokerImpl.java 30 Jan 2003 15:16:51 -0000 1.118
> +++ PersistenceBrokerImpl.java 31 Jan 2003 12:48:10 -0000
> @@ -2018,7 +2018,7 @@
> }
> for (int i = 0; i < itemClassFks.length; i++)
> {
> - criteria.addEqualToColumn(
> + criteria.addEqualToField(
> cod.getIndirectionTable() + "." +
> itemClassFks[i].toString(),
> refCld.getPkFields()[i].getAttributeName());
> }
>
> Igor.Petrenko@adminteractive.com.ua wrote:
>
>> Index: PersistenceBrokerImpl.java
>> ===================================================================
>> RCS file:
>> /home/cvspublic/jakarta-ojb/src/java/org/apache/ojb/broker/singlevm/PersistenceBrokerImpl.java,v
>> retrieving revision 1.117
>> diff -r1.117 PersistenceBrokerImpl.java
>> 2022,2023c2022,2023
>> < cod.getIndirectionTable() + "." +
>> itemClassFks[i].toString(),
>> < refCld.getPkFields()[i].getAttributeName());
>> ---
>>
>>
>>> refCld.getPkFields()[i].getAttributeName()),
>>> cod.getIndirectionTable() + "." +
>>> itemClassFks[i].toString());
>>>
>>
>>
>>
>> -----Original Message-----
>> From: Sander Hofstee [mailto:sander.hofstee@topicus.nl]
>> Sent: Thursday, January 30, 2003 5:10 PM
>> To: OJB Developers List
>> Subject: Column: 'id' in where clause is ambiguous
>>
>>
>> Sorry, put it in the wrong thread.
>>
>> I downloaded the latest CVS version of ojb and tried to make this work.
>> But when I try to load an object with an indirection table I get an
>> error:
>> General error: Column: 'id' in where clause is ambiguous
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: ojb-dev-help@jakarta.apache.org
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: ojb-dev-help@jakarta.apache.org
>
>