Thank you for your reply, Kostya.


I am wondering whether I could generate this behaviour into BaseXXXPeer. I had a look at the Criteria src code and I don't think it would be to difficult. The only problem might be alias (BRAND as b1) in the FROM clause.

Regards,

Tarlika

Kostyantyn Shchekotykhin wrote:

Hi Tarlika,
you should write direct strings if you want to use aliases. I mean, you should get the attribute name from the Torque constant and concat alias name and attribute name.
String aliasName = "b1";
String b1brandName = aliasName + Brand.BRAND_NAME.substring(Brand.BRAND_NAME.indexOf("."));


Regards,
Kostya

T E Schmitz wrote:

Hello,

I have a table which references the same table twice. In SQL, I would express the SELECT (inner join) using an alias :

SELECT
SECTION.SECTION_PK,
SECTION.SECTION_NAME,
SECTION.BRAND_1_FK,
SECTION.BRAND_2_FK,
b1.BRAND_PK,
b1.BRAND_NAME,
b2.BRAND_PK,
b2.BRAND_NAME

FROM SECTION, BRAND  as b1,BRAND  as b2
where b1.BRAND_PK = BRAND_1_FK and
b2.BRAND_PK = BRAND_2_FK

Torque, however, will generate
BRAND.BRAND_PK,
BRAND.BRAND_NAME
as the columns are static variables fully qualified by the tableir name.


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



Reply via email to