You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "Lauber Markus, Bedag" <Ma...@bedag.ch> on 2006/03/01 11:58:08 UTC

AW: Problem joining two tables with same column name

Hi Jakob

I switched to the new version of OJB (1.0.4). But the new release
brought no improvement in the generation of the SQL statement. It still
has no alias prefixes for the first table in the where clause. 

 SELECT A0.COLUMN1,A0.COLUMN2,A0.COLUMN3,A0.COLUMN4
 FROM T1 A0,T2 A1 WHERE A0.ID=A1.T1ID AND (( (COLUMN1 = '034') AND
COLUMN2 = '78777') AND  (A1.DATE >= '1900-12-12 12:00:00.0'))

Greetings
Markus


Re: AW: Problem joining two tables with same column name

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi markus,

do you have this problem on a 1:1 or 1:n relationship ?
could you eventually provide a test case ?

jakob

Lauber Markus, Bedag schrieb:
> Hi Jakob
> 
> I switched to the new version of OJB (1.0.4). But the new release
> brought no improvement in the generation of the SQL statement. It still
> has no alias prefixes for the first table in the where clause. 
> 
>  SELECT A0.COLUMN1,A0.COLUMN2,A0.COLUMN3,A0.COLUMN4
>  FROM T1 A0,T2 A1 WHERE A0.ID=A1.T1ID AND (( (COLUMN1 = '034') AND
> COLUMN2 = '78777') AND  (A1.DATE >= '1900-12-12 12:00:00.0'))
> 
> Greetings
> Markus
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01.03.2006

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


Re: AW: Problem joining two tables with same column name

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi markus,

imo the problem is addColumnEqualTo(). in the column-methods the 
translation flag is false, which means that ojb does not try to 
translate the attribute-name into a column-name (that's ok for columns).

but we also do not prefix the column-name with the alias, and this looks 
like a bug :(

i'll fix it for 1.0.5.

jakob

Lauber Markus, Bedag schrieb:
> Hi Jakob
> 
> I switched to the new version of OJB (1.0.4). But the new release
> brought no improvement in the generation of the SQL statement. It still
> has no alias prefixes for the first table in the where clause. 
> 
>  SELECT A0.COLUMN1,A0.COLUMN2,A0.COLUMN3,A0.COLUMN4
>  FROM T1 A0,T2 A1 WHERE A0.ID=A1.T1ID AND (( (COLUMN1 = '034') AND
> COLUMN2 = '78777') AND  (A1.DATE >= '1900-12-12 12:00:00.0'))
> 
> Greetings
> Markus
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01.03.2006

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


Re: AW: Problem joining two tables with same column name

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi markus,

in your original post i saw that you use addColumnEqualTo

	// c.setAlias("a1");
	c.addColumnEqualTo("COLUMN1","034");
	c.addColumnEqualTo("COLUMN2","78777");
	// Criteria c2 = new Criteria();

what's the reason no to use addEqualTo() ?

jakob

Lauber Markus, Bedag schrieb:
> Hi Jakob
> 
> I switched to the new version of OJB (1.0.4). But the new release
> brought no improvement in the generation of the SQL statement. It still
> has no alias prefixes for the first table in the where clause. 
> 
>  SELECT A0.COLUMN1,A0.COLUMN2,A0.COLUMN3,A0.COLUMN4
>  FROM T1 A0,T2 A1 WHERE A0.ID=A1.T1ID AND (( (COLUMN1 = '034') AND
> COLUMN2 = '78777') AND  (A1.DATE >= '1900-12-12 12:00:00.0'))
> 
> Greetings
> Markus
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01.03.2006

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