Topic: 使用jbuilder+weblogic开发cmp一对一的关联太难!!!

  Print this page

1.使用jbuilder+weblogic开发cmp一对一的关联太难!!! Copy to clipboard
Posted by: zbljava
Posted on: 2003-10-25 20:47

不知道为什么总会产生以下错误:

"ee.ejbgrpx": ERROR: Error from ejbc: Error while reading 'META-INF/weblogic-cmp-rdbms-jar.xml'. The error was:

"ee.ejbgrpx": In relationship 'orderlineitems-products', role 'ProductsRelationshipRole', invalid column 'PRODUCTID', a column-map element contains an invalid key-column. The key-column is not defined in the related bean or it's not recognized because of case mismatch.

有没有人用jbuilder开发cmp时遇到同样的问题呢?

2.Re:使用jbuilder+weblogic开发cmp一对一的关联太难!!! [Re: zbljava] Copy to clipboard
Posted by: zbljava
Posted on: 2003-10-25 20:56

但是使用many to one 则没有问题,真是奇怪啊!

one to one时的文件如下:

weblogic-cmp-extras.xml
<weblogic-rdbms-relation>
<relation-name>orderlineitems-products</relation-name>
<weblogic-relationship-role>
<relationship-role-name>ProductsRelationshipRole</relationship-role-name>
<column-map>
<foreign-key-column>PRODUCTID</foreign-key-column>
<key-column>PRODUCTID</key-column>
</column-map>
<relationship-role-map>
<foreign-key-table>PRODUCTS</foreign-key-table>
<primary-key-table>ORDERLINEITEMS</primary-key-table>
<column-map>
<foreign-key-column>PRODUCTID</foreign-key-column>
<key-column>PRODUCTID</key-column>
</column-map>
</relationship-role-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>

weblogic-cmp-rdbms-jar.xml

<weblogic-rdbms-relation>
<relation-name>orderlineitems-products</relation-name>
<weblogic-relationship-role>
<relationship-role-name>ProductsRelationshipRole</relationship-role-name>
<relationship-role-map>
<foreign-key-table>PRODUCTS</foreign-key-table>
<primary-key-table>ORDERLINEITEMS</primary-key-table>
<column-map>
<foreign-key-column>PRODUCTID</foreign-key-column>
<key-column>PRODUCTID</key-column>
</column-map>
</relationship-role-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>

many to one 时的文件如下:

weblogic-cmp-extras.xml
<weblogic-rdbms-relation>
<relation-name>orderlineitems-products</relation-name>
<weblogic-relationship-role>
<relationship-role-name>OrderlineitemsRelationshipRole</relationship-role-name>
<column-map>
<foreign-key-column>PRODUCTID</foreign-key-column>
<key-column>PRODUCTID</key-column>
</column-map>
<relationship-role-map>
<foreign-key-table>ORDERLINEITEMS</foreign-key-table>
<primary-key-table>PRODUCTS</primary-key-table>
<column-map>
<foreign-key-column>PRODUCTID</foreign-key-column>
<key-column>PRODUCTID</key-column>
</column-map>
</relationship-role-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>

weblogic-cmp-rdbms-jar.xml
<weblogic-rdbms-relation>
<relation-name>orderlineitems-products</relation-name>
<weblogic-relationship-role>
<relationship-role-name>OrderlineitemsRelationshipRole</relationship-role-name>
<relationship-role-map>
<foreign-key-table>ORDERLINEITEMS</foreign-key-table>
<primary-key-table>PRODUCTS</primary-key-table>
<column-map>
<foreign-key-column>PRODUCTID</foreign-key-column>
<key-column>PRODUCTID</key-column>
</column-map>
</relationship-role-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>

高手救命啊
我不知道primary-key-table 和 foreign-key-table 有什么作用?

3.Re:使用jbuilder+weblogic开发cmp一对一的关联太难!!! [Re: zbljava] Copy to clipboard
Posted by: chenyajun5
Posted on: 2003-10-25 22:59

http://www.cjsdn.com/post/view?bid=2&id=56515&tpg=1&ppg=1&sty=1&age=0

4.Re:使用jbuilder+weblogic开发cmp一对一的关联太难!!! [Re: zbljava] Copy to clipboard
Posted by: zbljava
Posted on: 2003-10-28 21:13

关联关键字的方法的确可行.可以select出关联的数据.
可是我依然不明白CMP,CMR的原理.

而且,插入数据的时候出错.

orderLineItems : Products (1:1)

abstract public class OrderlineitemsBean implements EntityBean {
public abstract void setProducts(Products products);
public abstract Products getProducts();
public void ejbPostCreate(String id, String orderid, Product product, int quantity, double discount) throws CreateException {
setProducts(product);
}

}

错误如下:

javax.ejb.EJBException: nested exception is: javax.ejb.EJBException: The setXXX
method for a cmr-field that is mapped to a primary key may not be called. The c
mr-field is read-only.
javax.ejb.EJBException: The setXXX method for a cmr-field that is mapped to a pr
imary key may not be called. The cmr-field is read-only.
at testejb2.OrderlineitemsBean_2418f2__WebLogic_CMP_RDBMS.setProducts(Or
derlineitemsBean_2418f2__WebLogic_CMP_RDBMS.java:494)
at testejb2.OrderlineitemsBean.ejbPostCreate(OrderlineitemsBean.java:35)

5.Re:使用jbuilder+weblogic开发cmp一对一的关联太难!!! [Re: zbljava] Copy to clipboard
Posted by: whoami0967
Posted on: 2003-10-29 18:52

我的1:1也没有做出来,因为有别的事情,所以就放下来了。因为现在没有软件环境,所以是什么错误我记不起来了。

to zbljava ,你能把你的many to one 发给我么?
不胜感激!
email: whoami0967◎yeah.net

6.Re:使用jbuilder+weblogic开发cmp一对一的关联太难!!! [Re: zbljava] Copy to clipboard
Posted by: zbljava
Posted on: 2003-11-03 22:58

有谁知道吗?

7.Re:使用jbuilder+weblogic开发cmp一对一的关联太难!!! [Re: zbljava] Copy to clipboard
Posted by: whoami0967
Posted on: 2003-11-05 11:34

谢谢,已收到~!


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923