2 Replies Latest reply on Mar 17, 2004 5:00 AM by Alexey Loubyansky

    ejbql to sql translation mismatch

    Micah Spears Newbie

      There seems to be a defect in the ejbql to sql generator as this example findAll() query shows:

      ejbql query: SELECT OBJECT(u) FROM Usage AS u ORDER BY u.id

      resultant sql query: SELECT t0_u.id, t0_u.id, t0_u.logon, t0_u.logoff, t0_u.computer, t0_u.user, t0_u.id FROM computer_usage t0_u ORDER BY t0_u.id ASC

      table schema: computer_usage { id BIGINT primary key, logon TIMESTAMP, logoff TIMESTAMP, user (foreign key for relationship), computer (foreign key for relationship) }

      the problem is the sql query now references the same column (t0_u.id) three times instead of once. if this because I have two relationships (user and computer) for this bean so the CMP container pulls the primary key an extra time for each relationship?

      if anyone can explain this behaivor and/or provide a wordaround, I would really appreciate it as I suspect a performance improvement could be obtained...