2013/3/14 Witold Szczerba <[email protected]> > Hi, > my test case with aliasing FOLDER.ID.as <http://folder.id.as/>(f_id) and > SUBJECT.ID.as <http://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 understand > 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" > The problem with that is: How would you recognise those system-generated aliases? You wouldn't be able to access any data from the result anymore, except if you access values by index... This gets worse if you start nesting SELECT statements. Then, jOOQ would "system-rename" the columns twice. The only backward incompatibility I can think of, is when user already > specified an explicit alias with identical name, but it seems very unlikely. > There is no such thing as "unlikeliness". Everything that can happen, will happen. A solution to this problem has to be sound, predictable and it has to work the same way for all databases - including the ones with native LIMIT .. OFFSET support. This needs some more thinking... 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.
