/** * Remove the given EJB instance. * @param ejb the EJB instance to remove * @see javax.ejb.EJBLocalObject#remove() */ protected void removeSessionBeanInstance(@Nullable EJBLocalObject ejb) { if (ejb != null && !this.homeAsComponent) { try { ejb.remove(); } catch (Throwable ex) { logger.warn("Could not invoke 'remove' on local EJB proxy", ex); } } }
/** * Remove the given EJB instance. * @param ejb the EJB instance to remove * @see javax.ejb.EJBLocalObject#remove() */ protected void removeSessionBeanInstance(@Nullable EJBLocalObject ejb) { if (ejb != null && !this.homeAsComponent) { try { ejb.remove(); } catch (Throwable ex) { logger.warn("Could not invoke 'remove' on local EJB proxy", ex); } } }
@ExpectWarning("BC_IMPOSSIBLE_DOWNCAST_OF_TOARRAY") public void cascadeDelete(Collection value) throws RemoveException { if(!value.isEmpty()) { EJBLocalObject[] locals = (EJBLocalObject[])value.toArray(); for(int i = 0; i < locals.length; ++i) { locals[i].remove(); } } } }
/** * Remove the given EJB instance. * @param ejb the EJB instance to remove * @see javax.ejb.EJBLocalObject#remove() */ protected void removeSessionBeanInstance(@Nullable EJBLocalObject ejb) { if (ejb != null && !this.homeAsComponent) { try { ejb.remove(); } catch (Throwable ex) { logger.warn("Could not invoke 'remove' on local EJB proxy", ex); } } }
public void cascadeDelete(EntityEnterpriseContext ctx) throws RemoveException { Collection value = (Collection)getValue(ctx); if(!value.isEmpty()) { EJBLocalObject[] locals = (EJBLocalObject[])value.toArray(); for(int i = 0; i < locals.length; ++i) { locals[i].remove(); } } }
//bean atribute private SessionContext context; //bean method call by the Container public void setSessionContext(SessionContet ctx) { context = ctx; } //your first delete code try { ... EJBLocalObject local_another_o = getEjbLocalObject(local_o.getAnotherId()); local_another_o.remove(); ... } catch (Exception e) { context.setRollbackOnly(); //log exception //throw new Exception } //idem for your second delete
public Object processInvocation(final InterceptorContext context) throws Exception { final EntityBeanComponent component = getComponent(context, EntityBeanComponent.class); if(remote) { component.getEJBObject(context.getParameters()[0]).remove(); } else { component.getEJBLocalObject(context.getParameters()[0]).remove(); } return null; } };
ejbObject.remove();
public void cascadeDelete(EntityEnterpriseContext ctx) throws RemoveException { if(manager.registerCascadeDelete(ctx.getId(), ctx.getId())) { EJBLocalObject value = (EJBLocalObject)getValue(ctx); if(value != null) { changeValue(null); final Object relatedId = value.getPrimaryKey(); final JDBCStoreManager2 relatedManager = (JDBCStoreManager2)relatedEntity.getManager(); if(!relatedManager.isCascadeDeleted(relatedId)) { value.remove(); } } manager.unregisterCascadeDelete(ctx.getId()); } }