cmp设置问题

wang_zheng_wz 2004-08-26 04:29:44
我用wsad5.0
我的ejb-jar.xml如下

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar id="ejb-jar_ID">
<display-name>ExamplesEJB</display-name>
<enterprise-beans>
<session id="JDBCTest">
<ejb-name>JDBCTest</ejb-name>
<home>examples.JDBCTestHome</home>
<remote>examples.JDBCTest</remote>
<ejb-class>examples.JDBCTestBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
<resource-ref id="ResourceRef_1091785455217">
<description></description>
<res-ref-name>dataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</session>
<entity id="Account">
<ejb-name>Account</ejb-name>
<home>examples.AccountHome</home>
<remote>examples.Account</remote>
<local-home>examples.AccountLocalHome</local-home>
<local>examples.AccountLocal</local>
<ejb-class>examples.AccountBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>examples.AccountPK</prim-key-class>
<reentrant>False</reentrant>
<resource-ref id="ResourceRef_1091776311099">
<description></description>
<res-ref-name>jdbc/ejbPool</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</entity>
<entity id="Product">
<ejb-name>Product</ejb-name>
<home>examples.ProductHome</home>
<remote>examples.Product</remote>
<local-home>examples.ProductLocalHome</local-home>
<local>examples.ProductLocal</local>
<ejb-class>examples.ProductBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>examples.ProductPK</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>ProductBean</abstract-schema-name>
<cmp-field id="CMPAttribute_1093491551667">
<field-name>basePrice</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_1093491439336">
<field-name>description</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_1093491568321">
<field-name>name</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_1093491560820">
<field-name>productID</field-name>
</cmp-field>
<query>
<description></description>
<query-method>
<method-name>findAllProducts</method-name>
<method-params></method-params>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(a) FROM ProductBean AS a WHERE productID IS NOT NULL]]></ejb-ql>
</query>
<query>
<description></description>
<query-method>
<method-name>findByBasePrice</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(a) FROM ProductBean AS a WHERE basePrice = ?1]]></ejb-ql>
</query>
<query>
<description></description>
<query-method>
<method-name>findByDescription</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(a) FROM ProductBean AS a WHERE description = ?1]]></ejb-ql>
</query>
<query>
<description></description>
<query-method>
<method-name>findByName</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(a) FROM ProductBean AS a WHERE name = ?1]]></ejb-ql>
</query>
<query>
<description></description>
<query-method>
<method-name>findCheapProducts</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(a) FROM ProductBean AS a WHERE basePrice < ?1]]></ejb-ql>
</query>
<query>
<description></description>
<query-method>
<method-name>findExpensiveProducts</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(a) FROM ProductBean AS a WHERE basePrice > ?1]]></ejb-ql>
</query>
</entity>
</enterprise-beans>
</ejb-jar>


为什么在任务视图中总是出现如下错误
种类 状态 优先级 描述 资源 在文件夹中 位置
错误 WQRY0108E: field productid is not defined ejb-jar.xml ExamplesEJB/ejbModule/META-INF 第 63 行
错误 WQRY0108E: field baseprice is not defined ejb-jar.xml ExamplesEJB/ejbModule/META-INF 第 71 行
错误 WQRY0110E: correlation id implicit qualifier is not defined. ejb-jar.xml ExamplesEJB/ejbModule/META-INF 第 81 行
错误 WQRY0110E: correlation id implicit qualifier is not defined. ejb-jar.xml ExamplesEJB/ejbModule/META-INF 第 91 行
错误 WQRY0108E: field baseprice is not defined ejb-jar.xml ExamplesEJB/ejbModule/META-INF 第 101 行
错误 WQRY0108E: field baseprice is not defined ejb-jar.xml ExamplesEJB/ejbModule/META-INF 第 111 行


...全文
192 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
wang_zheng_wz 2004-09-01
  • 打赏
  • 举报
回复
我的ProductBean.java如下
感觉没问题啊



package examples;


import javax.ejb.*;


public abstract class ProductBean implements EntityBean {
protected EntityContext ctx;

public ProductBean() {}

public abstract String getName();

public abstract void setName(String name);

public abstract String getDescription();

public abstract void setDescription(String description);

public abstract String getProductID();

public abstract void setProductID(String productID);

public abstract double getBasePrice();

public abstract void setBasePrice(double basePrice);


public void ejbActivate() {
System.out.println("ejbActivate() called.");
}

public void ejbRemove() {
System.out.println("ejbRemove() called.");
}

public void ejbPassivate() {
System.out.println("ejbPassivate() called.");
}

public void ejbLoad() {
System.out.println("ejbLoad() called.");
}

public void ejbStore() {
System.out.println("ejbStore() called.");
}

public void setEntityContext(EntityContext ctx) {
System.out.println("setEntityContext called");
this.ctx = ctx;
}

public void unsetEntityContext() {
System.out.println("unsetEntityContext called");
this.ctx = null;
}

public void ejbPostCreate(String productID, String name, String description, double basePrice) {
System.out.println("ejbPostCreate() called");
}

public ProductPK ejbCreate(String productID, String name, String description, double basePrice)
throws CreateException {
System.out.println("ejbCreate() called");

setProductID(productID);
setName(name);
setDescription(description);
setBasePrice(basePrice);

return new ProductPK(productID);
}
}
charlie0895 2004-08-27
  • 打赏
  • 举报
回复
我强烈建议用工具生成,这样写,又麻烦又容易错!
baffling 2004-08-26
  • 打赏
  • 举报
回复
做个记号!等下再来仔细看
myyucat 2004-08-26
  • 打赏
  • 举报
回复
你是在运行mastering EJB吧!
你的bean中的getproductID的方法名写成了getproductid。
charlie0895 2004-08-26
  • 打赏
  • 举报
回复
做个记号!等下再来仔细看

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧