租房买房买生意上iU91
查看: 445|回复: 8
打印 上一主题 下一主题

[电脑] Help!!! JBuilder and EJB

[复制链接]   [推荐给好友]
跳转到指定楼层
楼主
发表于 2002-9-2 22:51 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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
2#
发表于 2002-9-3 09:44 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

3#
 楼主| 发表于 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  .
回复 支持 反对

使用道具 举报

4#
发表于 2002-9-3 13:19 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

5#
 楼主| 发表于 2002-9-3 13:34 | 只看该作者
thx
回复 支持 反对

使用道具 举报

6#
 楼主| 发表于 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.
回复 支持 反对

使用道具 举报

7#
发表于 2002-9-3 16:18 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

8#
发表于 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.
回复 支持 反对

使用道具 举报

9#
 楼主| 发表于 2002-9-4 10:03 | 只看该作者
Done. Thx
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

Copyright © 1999 - 2024 by Sinoquebec Media Inc. All Rights Reserved 未经许可不得摘抄  |  GMT-5, 2024-12-22 05:04 , Processed in 0.048832 second(s), 42 queries .