2 Replies Latest reply on Dec 17, 2004 5:07 AM by fuck off

    Generated sql for Finder is wrong when xdoclet used

    fuck off Newbie

      Hi All,
      I have a finder defined thussly in the Entity Bean using xdoclet: -

      * @ejb.finder signature="java.util.Collection findByRole(java.lang.String user_role)"
       * unchecked="true"
       * view-type="local"
       * query="SELECT OBJECT(w) FROM WEBAPP_USER_ROLES w WHERE w.user_role = ?1"
      


      When I try and call this finder I get this exception

      java.sql.SQLException: ORA-00936: missing expression
      


      What is really odd is the SQL that JBoss is trying to execute looks like this: -

      Executing SQL: SELECT FROM WEBAPP_USER_ROLES t0_w WHERE (t0_w.user_role = ?)
      


      This is what is written to the log at deploy time for this method: -
      EJB-QL: SELECT OBJECT(w) FROM WEBAPP_USER_ROLES w WHERE w.user_role = ?1
      15:50:23:944 [main] SQL: SELECT FROM WEBAPP_USER_ROLES t0_w WHERE (t0_w.user_role = ?)
      


      The xdoclet generated deployment descriptor entry for this Entity looks the same as my hand coded descriptor. But when JBoss deploys the same bean using a hand coded descriptor I see this in the log:-
      EJB-QL: SELECT OBJECT(w)
       FROM WEBAPP_USER_ROLES w
       WHERE w.user_role = ?1
      11:58:10:753 [main] SQL: SELECT t0_w.user_name FROM WEBAPP_USER_ROLES t0_w WHERE (t0_w.user_role = ?)
      


      The difference is that the generated SQL is correct for the latter but incorrect for the former. I know its not the line breaks as I have tried the handcoded one all on one line and it works.

      This is just one example, the findByPrimaryKey and findAll methods are also incorrectly generated.

      Any help greatly appreciated.