Problem with method calling ejbSelect method

Discussions

EJB programming & troubleshooting: Problem with method calling ejbSelect method

  1. Problem with method calling ejbSelect method (2 messages)

    My problem is the helper method that is supposed to call the
    ejbSelect method.

    I have tried two ways:
    1)Having the method stub in the local interface.
    This is done using XDoclet tags like so:
    /**
     * @ejb.interface-method
     * view-type="local"
     */
     
     public Set listStockNumbers(){
       java.util.Collection collection = ejbSelectStockNumbers();
       etc. try, catch for the FinderException
     }
     
    2)Using an ejbHome method
    /**
     * @ejb.home-method
     * view-type="local"
     */
     
     public Set ejbHomeListStockNumbers(){
       the same as in 1) above;
     }
     
    The select method looks like this:
    /**
     * @ejb.select-method
     * query="SELECT distinct a.stockNumber from carSchema as a"
     *
     */
     public abstract Collection ejbSelectStockNumbers() throws FinderException;
     
    All these are in the CMP Entity Bean.

    Every time JBoss tells me From is not found. The local JNDI name is mentioned. If I take away the whole select method and its helper method block the bean deploys fine.

    I have scoured the Net for help. Mostly the topic is glossed over, making me think the anser is really very simple.

    Can anyone please help.

    Thanks,

    Chris

    Threaded Messages (2)

  2. Hi Antonie, my guess is that the problem is the EJB-QL sintax you are using.I can see two cases here:

      1)if the stockNumber is a CMR field, implementing a relationship, the query should look like this:
    query="SELECT OBJECT (b) FROM carSchema AS a IN(a.stockNumber) AS b"

      2)if it's a simple field than you should read all the carSchema and then use only the stockNumber.
    query="SELECT OBJECT (a) FROM carSchema AS a"
  3. Simple field[ Go to top ]

    Hi Sergio,

    It is a simple field. The ejbSelect method ejb ql I have should work. Your option 2 takes me away from ejbSelect methods and back to finder methods. That seems to be the only option left open to me. I have been trying to get this ejbSelect method thing to work now for nearly a week - no go.

    Ah well, back to finder methods for everything for me.

    Thanks for your help.

    Chris