hi terry,

ojb always adds orderby or grouppby columns to the select columns if they are not already there. the only thing i did in my patch was adding an alias ojb_col_x to the automatically added columns.

the two columns in your sample are treatd as two *different* columns because the lookup in select columns is done simply by column name, so 'bar' does not match 'foo as bar'. you'll have to use query.addOrderBy("foo as bar")

hth
jakob

Terry Brick wrote:
Jakob,
Thanks for fixing this. It looks like the fix is possibly causing a problem in report queries. Interestingly enough, I never even used report queries before today, but the cause of this problem
definitely looks related to the alias solution.


If one of my columns in my report query has an alias and then that alias is used in an 
orderby or
a groupby, then that alias is added to my column list as a column!

For example:
query.setColumns("foo as bar");

-- work fine, unless I do something like following ---

query.addOrderBy("bar");


-- or --


query.addGroupBy("bar");

If I do this OrderBy or GroupBy, with a column alias, it adds that alias to my select columns.. The sql will come out something like...

select foo as bar, bar as obj_col1 from foos order by xxxxxx....

As you can see, "bar as obj_col1" is a problem....


Thanks...



--- Jakob Braeuchi <[EMAIL PROTECTED]> wrote:


hi terry,

i checked in a quick fix using column alias.

jakob

Jakob Braeuchi wrote:


hi terry,

i can reproduce the problem and i posted it to the developer list:

http://article.gmane.org/gmane.comp.jakarta.ojb.devel/4830

thanks for the testcase.
jakob



__________________________________
Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003
http://search.yahoo.com/top2003

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to