Hello Rainer,
thanks for the fast answer.
The generated SQL will be something like that:
SELECT *
FROM
TableA t1 INNER JOIN TableB t2
ON t1.id_a = t2.id_a
LEFT JOIN TableA t1
ON t1.id_a = t2.id_a
In our application there are more joins and some where clauses which require
the left join here...
As you can see the table alias t1 has to be different at the second join to
get that statement working.
Regards,
Pascal
2010/8/17 Rainer Döbele <[email protected]>
> Can you give us the sql that has been generated?
>
> (you may call cmd.getSelect() to get it)
>
>
>
> Regards
>
> Rainer
>
>
>
>
>
> *from:* T-Rex [mailto:[email protected]]
> *to:* [email protected]
> *re:* column ambigously defined / table alias
>
>
>
> Hello empire-db community,
>
> in our application we've got a similar problem like the given example
> below.
> We build a command object with different joins depending on different
> expressions.
>
> As you can see we have an inner join and a left outer join on the same
> tables.
> If we execute the statement we get the exception: column ambiguously
> defined.
> From our point of view the framework is not able to set the table aliases
> on it's own if required and
> we do not have the possibility to set the alias manually.
>
> Furthermore we see not the possibility to create a full outer join.
>
> Example:
> ###################################################
>
> public class PROJECTDB extends DBDatabase
> {
> public TTableA T_TABLEA;
> public TTableB T_TABLEB;
>
> public static class TTableA extends DBTable
> {
> // Spaltendefinitionen
> public final DBTableColumn C_ID_A;
> public final DBTableColumn C_VALUE_A;
> public final DBTableColumn C_ID_C;
> ...
> }
> public static class TTableB extends DBTable
> {
> // Spaltendefinitionen
> public final DBTableColumn C_ID_A;
> public final DBTableColumn C_VALUE_B;
> ...
> }
>
>
> ...
>
> }
>
> public class DO_SOME_THING
> {
>
> ...
>
> public method_B (DBCommand cmd)
> {
> cmd.join (PROJECTDB.TTableA.C_ID_A, PROJECTDB.TTableB.C_ID_A,
> DBJoinType.INNER);
> }
>
> public method_C (DBCommand cmd)
> {
> cmd.join (PROJECTDB.TTableA.C_ID_A, PROJECTDB.TTableB.C_ID_A,
> DBJoinType.LEFT);
> }
>
> ..
>
> public method_A
> {
> DBCommand cmd = ...;
>
> if (expressionX()) {
> method_C(cmd);
> }
>
> if (expressionY()) {
> method_B(cmd);
> }
> ...
> readValuesFromDB(cmd);
> ...
>
> }
> ###################################################
>
> Do you have any clues?
>
> Regards,
>
> Pascal
>