2 Replies Latest reply on Mar 28, 2006 2:13 AM by cwad0000

    Correct EJB-QL generates faulty SQL. any ideas?

    cwad0000

      When looking in my server.log I see the following is created:

      17:53:36,498 DEBUG: EJB-QL: SELECT OBJECT(o) FROM GenericRelation o WHERE (o.parent_type = ?1)
      17:53:36,498 DEBUG: SQL: SELECT FROM glb_gen_relation t0_o WHERE ((t0_o.parent_type = ?))

      I was expecting it to generate this SQL:
      17:53:36,498 DEBUG: SQL: SELECT t0_o.id FROM glb_gen_relation t0_o WHERE ((t0_o.parent_type = ?))

      Can anyone see what might be wrong? Naturally, I get Sql Exceptions regarding faulty Sql when I call that finder method..

      I am using MySql, and my query definition and my table:


      <query-method>
      <method-name>findItemsBelongingToParent</method-name>
      <method-params>
      <method-param>java.lang.Integer</method-param>
      </method-params>
      </query-method>
      <ejb-ql>SELECT OBJECT(o) FROM GenericRelation o WHERE (o.parent_type = ?1)</ejb-ql>


      create table glb_gen_relation (
      id INT AUTO_INCREMENT, primary key (id),
      parent_type int not null,
      node int not null
      );