3 Replies Latest reply on Apr 27, 2002 3:08 PM by David Jencks

    custom finder problem

    Honda Civic Newbie

      I would like define a custom finder in a cmp entity bean that returns the largest id.

      The table MY_TABLE has these 2 fields:
      id integer
      something varchar

      In my home cmpBeanHome, I have declared this method:

      public cmpBean findMaxID() throws RemoteException, FinderException;

      Then, in my jaws.xml, I added:




      MY_TABLE.id = (select max(MY_TABLE.id) from MY_TABLE group by MY_TABLE.id)



      When calling findMaxID(), the error I got was

      javax.servlet.ServletException: Find failed, msg=java.sql.SQLException: Column not found: ID in statement [SELECT MY_TABLE.id FROM MY_TABLE where MY_TABLE.id = (select max(MY_TABLE.id) from MY_TABLE group by MY_TABLE.id)]

      Why did it complain about the column "id"?

      Also, on the documentation, there is very little explanation on having custom finders in the bean itself, instead of in jaws.xml. Has anyone tried this before?