0 Replies Latest reply on Nov 15, 2001 8:08 AM by jcordes

    Problem with generated SQL for EJB-QL

    jcordes

      Hi all !

      When trying a query on a many-to-many relationship I'm experiencing some troubles with the SQL generated by JBoss. Currently I'm using the recent sources from CVS (jboss3.0.0alpha). The ejb-ql is

      <ejb-ql>
      SELECT OBJECT(a) FROM Article a, IN (a.catalogStructure) AS c WHERE c.id = ?1
      </ejb-ql>

      It deploys fine, no problem with that. The SQL generated by JBoss is

      findByCategory command executing: SELECT t2_
      a.id FROM Article t2_a, Catalog_Structure t1_c, Catalog_Structure_Article t3_t2_
      a_to_catalogStructure WHERE (t1_c.id = ?) AND t2_a.id=t4_t2_a_to_catalogStructur
      e.article_id AND t1_c.id=t4_t2_a_to_catalogStructure.catalog_stucture_id

      What I recognize is that t4_t2_a_to_catalogStructure should be t3_t2_a_to_catalogStructure. Is this a bug or am I doing something really wrong ? The corrected SQL returns the rows as expected.

      Please help,

      Jochen.