Hi list,
While iterating through a Collection of children in a one-to-many CMR that I 
obtained by a child bean finder method, I use the child's CMR accessor to get 
a reference to the parent entity, and then get some of the parent fields.

However, if the parent is non-existent (these data are from two pre-existing 
databases where the child set is older than the parent set, so many of the 
older children are orphans) I get a javax.ejb.NoSuchObjectLocalException that 
appears to be uncatchable from my code.  I just want to be able to catch the 
exception where the parent is not found for one of the children, but keep 
iterating through the rest of the children.  But the above-mentioned 
exception causes a TransactionRolledbackLocalException which invalidates 
everything and causes the rest of the iteration to fail.

here is a sample of the code (csr
                LocalCSRequest csr = (LocalCSRequest)i.next();
                ...
                CSRViewObject vo = new CSRViewObject();
                vo.status = csr.getStatus();
                try {
                        LocalJob job = csr.getJob(); //** THIS IS THE PARENT ENTITY 
ACCESSOR **
                        vo.job = job.getJobID(); //** THIS WHERE THE EXCEPTION IS 
THROWN **
                }
// ** THESE DON'T GET CAUGHT **
                catch(NoSuchObjectLocalException nsole) {
                        System.err.println("No Job entity found for csr " + 
csr.getCSRequestID());
                }
                catch(Exception e) {
                        System.err.println("No Job found for csr " + 
csr.getCSRequestID() +
                                " exception is type " + e.getClass());
                }
                return vo;


here is the end of the stack trace:
[org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException, 
causedBy:
javax.ejb.NoSuchObjectLocalException: Entity not found: primaryKey=21026
        at 
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:181)
        at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)

(etc.)

Does anyone have any thoughts as to why my code won't catch the 
NoSuchObjectLocalException ?  Maybe I'm missing something completely obvious.
Thanks in advance for any advice.
Justin



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to