wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes Please help me on using EJB-QL with JBoss 4.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Please help me on using EJB-QL with JBoss 4.0" Watch "Please help me on using EJB-QL with JBoss 4.0" New topic
Author

Please help me on using EJB-QL with JBoss 4.0

James Zhang
Ranch Hand

Joined: Sep 06, 2002
Posts: 30
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please help me on using EJB-QL with JBoss 4.0
 
Similar Threads
JBOSS CMP finder methods
CMP beans not entering data in database
Null Pointer exception thrown while deploying the cmp bean
CMP 2.0 problem in Jboss 4.0.2
Entity Bean on JBoss4.0.2