Hi, my test case with aliasing FOLDER.ID.as(f_id) and SUBJECT.ID.as(s_id) works fine, but it is impossible to apply that workaround to queries across the system, as we have rather complex mappers, most of the time specified elsewhere (some are reusable) and those mappers does not know about the aliases used to create the query. Also, queries produce like 30-40 columns, so we would have to enumerate (and alias) each and every column in every query (most of the times we use implicit columns by just not adding any to the queries). All that would turn simple and concise queries into huge, hard to maintain monsters.
I was thinking, if JOOQ could automatically alias the TableFields when rendering the inner query (or any query). Alias could be a concatenation of a table and column, with dot replaced by underscore, example: select "FOLDER"."ID" FOLDER_ID, "SUBJECT"."ID" SUBJECT_ID from "FOLDER" or even better, the alias could be more generic, not related to columns; I think it would be safer, simpler and less verbose: select "FOLDER"."ID" c1, "SUBJECT"."ID" c2, ... c3, ...cN, ... cN+1 from "FOLDER" join ... The only backward incompatibility I can think of, is when user already specified an explicit alias with identical name, but it seems very unlikely. Regards, Witold Szczerba On 14 March 2013 00:37, Lukas Eder <[email protected]> wrote: > Hi, > > Thanks for reporting this. I have registered #2335 for this problem: > https://github.com/jOOQ/jOOQ/issues/2335 > > I'll have to think about a solution within jOOQ. I'm not sure if there is > one for Oracle, SQL Server, DB2 and Sybase SQL Anywhere, where these kinds > of subqueries are generated to simulate LIMIT ... OFFSET. > > Your hypothesis would work at the client site. You should explicitly > rename FOLDER.ID and SUBJECT.ID to something like f_id and s_id, as a > workaround to avoid this ambiguity > > Cheers > Lukas > > -- > You received this message because you are subscribed to the Google Groups > "jOOQ User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
