• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Please help me on using EJB-QL with JBoss 4.0

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to follow the CMP example code from book "Teach yourself EJB in 21 days", but my JBoss server always give me the following deploy error:

org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT OBJECT(o) FROM Order AS o
WHERE o.status = ?1'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "Order" at line 1, column 23.
Was expecting one of:
"IN" ...
<ABSTRACT_SCHEMA> ...
)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.<init>(JDBCEJBQLQuery.java:52)
...

I checked the configuration files and am quite sure that the schema name is correct. Here is related potion of my ejb-jar.xml file:

...
<entity>
<ejb-name>OrderEJB</ejb-name>
<home>day11.OrderHome</home>
<remote>day11.Order</remote>
<ejb-class>day11.OrderEJB</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Order</abstract-schema-name>
<cmp-field>
<field-name>orderId</field-name>
</cmp-field>
<cmp-field>
<field-name>studentId</field-name>
</cmp-field>
<cmp-field>
<field-name>orderDate</field-name>
</cmp-field>
<cmp-field>
<field-name>status</field-name>
</cmp-field>
<cmp-field>
<field-name>amount</field-name>
</cmp-field>
<primkey-field>orderId</primkey-field>
<query>
<query-method>
<method-name>findByStatus</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(o) FROM Order AS o
WHERE o.status = ?1]]>
</ejb-ql>
</query>
<query>
<query-method>
<method-name>ejbSelectAllOrderAmounts</method-name>
<method-params>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT o.amount FROM Order AS o
WHERE o.orderId IS NOT NULL]]>
</ejb-ql>
</query>
</entity>
...

And the jbosscmp-jdbc.xml:

...
<defaults>
<datasource>java:/DefaultDS</datasource>
<datasource-mapping>mySQL</datasource-mapping>
<create-table>true</create-table>
<remove-table>false</remove-table>
<pk-constraint>true</pk-constraint>
<preferred-relation-mapping>foreign-key</preferred-relation-mapping>
</defaults>
...

Anybody has similar problem before? Any suggestion would be greatly appreciated!

Thanks!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic