• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in accessing EJB Relationship method.....

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic