蒙城华人网

标题: Help!!! JBuilder and EJB [打印本页]

作者: JavaBoy    时间: 2002-9-2 22:51
标题: Help!!! JBuilder and EJB
Database table(Product)roductID(key), Name, basePrice, Description
I created an CMP EJB2.O Bean(Bean name: Product). When I wanted to define a finder method( findByName), useing (String name) as a only method parameter,using following EJB QL: SELECT OBJECT(p) FROM Product(p) WHERE p.name=?1, But I always got a error message as following:

"product.ejbgrpx": Could not parse EJB QL expression: SELECT OBJECT(p) FROM ProductBean AS p WHERE p.name=?1

Appreciate expert's help greatly
作者: skytrue    时间: 2002-9-3 09:44
提示: 作者被禁止或删除 内容自动屏蔽
作者: JavaBoy    时间: 2002-9-3 12:35
Thx for ur reply.

I created a table with name "product".I used JBuilder to create a CMP EJB2.0 bean with name Product, which includes six filesroduct.java,ProductBean.java, ProductHome.java, ProductLocal.java, ProductLocalHome.java, ProductPK.java

When I wanted to define "finder" method for this bean, Jbuilder wanted me to write query for this method. I know I should use EJB QL, not SQL. After I inputed that sentenc, then make it, JBuilder report errors as I posted before.

I did not produce any code. I used JBuilder to create EJB directly. I did not understand ur meaning quite well, I am a beginner for EJB  .
作者: skytrue    时间: 2002-9-3 13:19
提示: 作者被禁止或删除 内容自动屏蔽
作者: JavaBoy    时间: 2002-9-3 13:34
thx
作者: JavaBoy    时间: 2002-9-3 14:37
Hi, I changed abstractSchemaName to be ProductSN. Then, I wrote following:
SELECT OBJECT(p) FROM ProductSN AS p WHERE p.name=?1. I got same problem. I checked my ejb-jar.xml, I got "SELECT OBJECT(p) FROM ProductSN AS p WHERE p.name=?1", not "![CDATA [SELECT OBJECT(p) FROM ProductSN AS p WHERE p.name=?1]]". The I wrote following ejb ql sentence:"![CDATA [SELECT OBJECT(p) FROM ProductSN AS p WHERE p.name=?1]]". But I got same error. I don't know what happened? Pls provide help. Thanks a lot in advance.
作者: skytrue    时间: 2002-9-3 16:18
提示: 作者被禁止或删除 内容自动屏蔽
作者: Clone    时间: 2002-9-3 20:40
Hi Frank,

I tried to write EJB QL as following again: SELECT OBJECT(p) FROM ProductSN p WHERE p.name=?1, it still did not work. Did u try JBuilder at home? What should I write about EJB QL? I already followed the instructions from Website.
作者: JavaBoy    时间: 2002-9-4 10:03
Done. Thx




欢迎光临 蒙城华人网 (https://www.sinoquebec.com/) Powered by Discuz! X3.1