Hello,

- i have an EntityBean which throws an
ObjectNotFoundException in its ejbFindByPrimaryKey() method
if the requested record could not be read.

- i have a SessionBean which resolves in its ejbCreate() method
the HomeInterface from some EntityBeans.
!! <transaction-type>Container</transaction-type> !!

- in one of my methods of the SessionBean, i tried to locate a record
from the EntityBean via a call to home.findByPrimaryKey(newPK).

coding in my SessionBeanmethod getit(String myparam):
   try {
      myPK = new beanPK(myparam);
      sref = shome.findByPrimaryKey(myPK);
      //-> ok, got it
   } catch(Exception ex) {
     //catch all exceptions thrown by the EntityBean
     ... set some default values and 
     ... return to the user, forget the exception.
     return;
   }
   
not very exotic until here!(?)

my client code is also very simple:

   try {
         ref = home.create();
       } catch( ...

   try {
         ref.getit(myparam);
       } catch( ...

i expect now that the exception was caught by the SessionBean if the
record was not found and then normally return to the clientcode.
BUT the exception was propagated to the clientcode:
   Transaction was rolled back:
      javax.ejb.EJBException: ejbFindByPrimaryKey: Row for id ABC not found.;
       nested exception is: 
        javax.ejb.EJBException: ejbFindByPrimaryKey: Row for id ABC not found.

with Sun's J2SDKEE and Inprise IAS it works as i expect!

IF I SWITCH my SessionBean to
  <transaction-type>Bean</transaction-type>
it works with orion too
 (UNTIL you try to use begin(), commit() - NullPointerException).

any hints? 

thanks
  klaus
 
--
Klaus Thiele - Personal & Informatik AG
mailto:[EMAIL PROTECTED]

 "There's got to be more to life than compile-and-go."

Reply via email to