Discussions

EJB programming & troubleshooting: What's up with EJB-QL... doesn't work!

  1. What's up with EJB-QL... doesn't work! (4 messages)

    Hi,
    sorry, i'm a little mad at the moment, you know....
    I simply don't understand what is wrong with the following syntax.

    SELECT OBJECT(c) FROM MyStoreItem AS c WHERE c.price = 0

    I keep getting a error when trying to deploy the bean!
    Can anyone help me? The log follows at the botton
    Thanks a lot,
    ltcmelo

    2004-03-19 19:40:53,390 ERROR [org.jboss.ejb.EntityContainer] Starting failed
    org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT OBJECT(c) FROM MyStoreItem AS c WHERE c.price = 0'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "MyStoreItem" at line 1, column 23.
    Was expecting one of:
        "IN" ...
        <ABSTRACT_SCHEMA> ...
        )
    at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.<init>(JDBCEJBQLQuery.java:50)
    at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createEJBQLQuery(JDBCCommandFactory.java:59)
    at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManager.java:212)
    at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:490)
    at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:388)
    at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:152)
    at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:342)
    at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
    at sun.reflect.GeneratedMethodAccessor32.invoke(Unknown Source)
    at sun.re
     ....
    ...
    ...
    ...
  2. It looks like you use the letter "o" where you meant to use the number "0".
  3. Not really, i'm using the number 0, and not the letter o.
    They look the same with this formatting.
  4. My apologies :)

    OK. Here are some more ideas:

    1) Does "MyStoreItem" match the abstract-schema-name you assigned to the database table for your EJB in the ejb-jar.xml file?

    2) Is price a CMR field instead of a CMP field?

    Other than that, I don't see a problem; the syntax of the EJB-QL itself looks correct to me.
  5. I had the absctract schema name incorrect!
    thanks,
    ltcmelo