Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in accessing EJB Relationship method.....  RSS feed

 
Pras Tiwari
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using CMP EJB2.0 for my web application with CMR. I have 2 Beans PartsMasterBean & PartsDetailBean having 1 to many relationship in them. I ve sucessfully defined relationship between then in Beans Implementation class as follows:-
PartsMasterBean.java
==========
public abstract Collection getPartsDetail();
public abstract void setPartsDetail(Collection c);
==========

PartsDetailBean.java
===========
public abstract PartsMasterLocal getPartsMaster();
public abstract void setPartsMaster(PartsMasterLocal el);
==========
When I m deploying my beans jar on server (JBOSS4.0.3 RC1) it gets succefully deployed. But problem occurs with accessing following method from my client file:-
Client.java
============
PartsMasterLocal pmlocal;
PartsMasterLocalHome pmlhome;
PartMasterValueObject pmvo;
PartsDetailLocal pdlocal;
/******
-------all lookup code here----------
*******/
pmlocal=pmlhome.findByPrimaryKey("P000001");
Collection c1=pmlocal.getPartsDetail();
Iterator i=c1.iterator();
while(i.hasnext()){
pdlocal=(PartsDetailLocal)i.next(); //on this line i m getting error of
//Classcastexception
}
============

According to above code i should get the proper records in detail corresponding to those with matching pk-field from partsmaster. But it throws error. How should i handle this???

Thanx.
Prash
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!