db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vitzethum, Daniel" <Daniel.Vitzet...@gigatronik.com>
Subject AW: Can't handle same column name twice - possibly a bug in village?
Date Wed, 15 Dec 2004 10:54:01 GMT
Hi Richard, Hi Thomas,

Thomas:
> I suppose you use your JoinHelper.
you are right, as usual ;-)

> Are you sure it is not a bug in there ?
I am, as I had tested the same situation with just two tables
joined with a Torque-generated "doSelectJoin..." method.

The problem is a bit different, I will try to explain:
(pk = Primary Key, fk = Foreign Key)

table TEST_PERSON
  pk P_ID      (in example: 1)
  fk G_ID      (in example: 10)
  fk L_ID      (in example: 100)

table TEST_LENDING (a person can be lended to an other group)
  pk L_ID      (in example: 100)
  fk G_ID      (in example: 20) !!

table TEST_GROUP
  pk G_ID      (in example: 10 and 20)


I can reproduce the following behavior:

Select directly on DB:
  SELECT
  a.g_id, b.g_id
  FROM
  test_person a, test_lending b
  WHERE
  a.l_id = b.l_id
returns correctly:
  10 (for a.g_id) and 20 (for b.g_id)

This code:
  Criteria cr =  new Criteria();
  cr.addJoin(TestPersonPeer.L_ID, TestLendingPeer.L_ID);
  TestPersonPeer.addSelectColumns(cr);
  TestLendingPeer.addSelectColumns(cr);
  List list = TestPersonPeer.doSelectVillageRecords(cr);
  Record record = (Record) list.get(0);

builds a correct Criteria with qualified columns that works
well on DB:
  SELECT
  TEST_PERSON.P_ID, TEST_PERSON.G_ID, TEST_PERSON.L_ID
  , TEST_LENDING.L_ID, TEST_LENDING.G_ID
  FROM
  TEST_PERSON
  , TEST_LENDING
  WHERE
  TEST_PERSON.L_ID=TEST_LENDING.L_ID

but leads to the following Record object:
  {'1','10','100','100','10'}
        ^^               ^^
 right /         wrong! /


I still come to the conclusion that there is something wrong in village.
If you agree, I will try to bring this to the village developers.


Thank your very much,

Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message