0 Replies Latest reply on Jun 6, 2005 6:50 PM by beamer908

    Can't override findByPrimaryKey()

    beamer908

      I'm having a problem where I'm declaring (through xdoclet) a finder method in my bean class and the method is not being invoked correctly.

      The xdoclet code:

       * @ejb.finder
       * signature="com.hannonhill.object.interfaces.Folder findByPrimaryKey(java.lang.String pk)"
       * query="select object(x) from Folder as x where x.id = ?1 and x.isRecycled = FALSE"
      


      in the bean class declared by:
       * @ejb.bean
       * name="Folder"
       * type="CMP"
       * view-type="local"
       * local-jndi-name="ejb/Folder"
       * reentrant="true"
       * primkey-field="id"
       * schema="Folder"
       * transaction-type="Container"
       * cmp-version="2.x"
      


      The call to the find method:
      return new FolderAdapter(FolderUtil.getLocalHome().findByPrimaryKey(entityId));
      


      which produces the following DEBUG output:
      18:32:42,687 DEBUG [Folder#findByPrimaryKey] Executing SQL: SELECT t0_Folder.id FROM cxml_folder t0_Folder WHERE t0_Folder.id=?
      


      Clearly the wrong query is getting executed, and I was wondering if this is a problem with overriding findByPrimaryKey(). Additionally, I could never find a place where the query for findByPrimaryKey was defined. I don't know if XDoclet just automatically generates it for all EntityBeans or what.