0 Replies Latest reply on Jun 26, 2008 9:14 AM by Paul Carroll

    Reference Foreign Key in EJB-QL

    Paul Carroll Newbie

      I have a one-to-many ejb-relation configured. I am trying to create an ejb-ql or jboss-ql query where I need to reference the foreign key of the one side of the ejb-relation. Since I cannot explicitly enter this foreign key as a <cmp-field> in the many side of the , it appears I cannot write the following:

      <ejb-ql>
       <![CDATA[SELECT OBJECT(p) FROM PartStructure p WHERE p.foreignKeyId = ?1 AND p.partName = ?2]]>
      </ejb-ql>
      


      I get the following error when I start JBoss:


      org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT OBJECT(p) FROM PartStructure p WHERE p.foreignKeyId = ?1 AND p.partName = ?2'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.UnknownPathException: Unknown terminal field: at line 1, column 51. Encountered: "foreignKeyId" after: "p.")


      Is it possible to reference that foreignKeyId in the ejb-ql or jboss-ql? Thanks.