Hi David ,
  
  If i ignoring the exception , didn't the method will throw null
pointer exception to client.
  I have do a testing and found that because my session is stateless
bean , instance variable is not specific for all client.
  If i change the session to stateful , the method will throw null
pointer exception.

  Am I correct to said that ?

 Thanks 
  

David Jencks wrote:
> 
> Hi,
>   I doubt your code as reported is complete.  From what you show us, the
> object returned from getProjectInfoJB is never created.
> 
> The "no exception" is presumably from your trapping and ignoring the
> FinderException when you look for your bean.  I suspect what is happening
> is that jboss is reusing the same session bean for your two calls, and
> since ejb attributes don't get reset by the container, it still has the
> reference to the first bean.  The finder exception from looking for a
> nonexistent bean skips the assignment of projectinfo, so you call the "2"
> bean getProjectInfoJB().
> 
> david jencks
> 
> On 2001.05.10 04:39:11 -0400 Russell wrote:
> >
> >   Hi all , I am using RedHat6.1 , jdk1.3 and jboss2.1 .
> >
> >   I have an entity bean , method below is the implementation code is
> > most important which to increase ejb performance using value object:
> >
> >    public ProjectInfoJB getProjectInfoJB() throws RemoteException{
> >
> >       projectinfojb.setAgreementdate(this.agreementdate);
> >       projectinfojb.setClient(this.client);
> >       projectinfojb.setCommencementdate(this.commencementdate);
> >       projectinfojb.setComments(this.comments);
> >       projectinfojb.setCompanyid(this.companyid);
> >       projectinfojb.setCompletedate(this.completedate);
> >       projectinfojb.setContractor(this.contractor);
> >       projectinfojb.setContractorperiod(this.contractorperiod);
> >       projectinfojb.setContractvalue(this.contractvalue);
> >       projectinfojb.setCountry(this.country);
> >       projectinfojb.setInchargedp(this.inchargedp);
> >       projectinfojb.setInchargeperson(this.inchargeperson);
> >       projectinfojb.setOthersconsultant(this.othersconsultant);
> >       projectinfojb.setProjectid(this.projectid);
> >       projectinfojb.setProjectname(this.projectname);
> >       projectinfojb.setProjectno(this.projectno);
> >       projectinfojb.setProjecttype(this.projecttype);
> >       projectinfojb.setServicescope(this.servicescope);
> >       projectinfojb.setStatus(this.status);
> >
> >     return projectinfojb;
> >
> > }
> >
> >  And i have a method in stateless session bean :
> >
> >  private ProjectInfoHome projectinfohome;
> >  private ProjectInfo projectinfo;
> >
> >  public ProjectInfoJB getProjectInfoJB(int projectid) throws
> > RemoteException{
> >
> >     try{
> >      projectinfo = projectinfohome.findByPrimaryKey(new
> > ProjectInfoPK(projectid));
> >     }
> >     catch(Exception e){}
> >     return projectinfo.getProjectInfoJB(); -->get value object
> >
> >   }
> >
> >  This method is giving me some problems. It can find the record without
> > any problems.
> >  However when the first time i called the method for example below:
> >
> >
> >   1st time :
> >     ProjectInfoJB jb = getProjectInfo(2) -->2 is exist in table so it
> > can find the records.
> >     System.out.println(jb.getProjectid()) --> display projectid = 2 is
> > correct.
> >
> >    But then when run the second time ,
> >
> >     ProjectInfoJB jb = getProjectInfo(99999) --> 99999 is not exist in
> > the table, did not throw me nay exception
> >     System.out.println(jb.getProjectid()) ---> is display projectid = 2
> > , which is wrong
> >
> >   Anybody why jboss behaviour like that ?? Any suggestions ? Thanks wt
> >
> > _______________________________________________
> > JBoss-user mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/lists/listinfo/jboss-user
> >
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to