/** * Private method to finally clean up the connections */ private void cleanUp() { try { session.remove(); } catch(RemoveException remove_ex) { log.error("AlarmListJ2eeConnectionManagerThread.lookupBean() Cannot remove session", remove_ex); } catch(RemoteException remote_ex) { log.error("AlarmListJ2eeConnectionManagerThread.lookupBean() Connection to bean lost", remote_ex); } }
/** * A container invokes this method before it removes the EJB object * that is currently associated with the instance. This method * is invoked when a client invokes a remove operation on the * enterprise Bean's home interface or the EJB object's remote interface. * This method transitions the instance from the ready state to the pool * of available instances. */ public void ejbRemove() throws RemoveException, EJBException, RemoteException { try { final InitialContext jndiContext = new InitialContext(); final DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase"); final Connection con = ds.getConnection(); try { final PreparedStatement stmt = con.prepareStatement("delete from entity where id = ?"); try { final Integer primaryKey = (Integer) ejbContext.getPrimaryKey(); stmt.setInt(1, primaryKey.intValue()); stmt.executeUpdate(); } finally { stmt.close(); } } finally { con.close(); } } catch (final Exception e) { e.printStackTrace(); throw new javax.ejb.EJBException(e); } }
/** * A container invokes this method before it removes the EJB object * that is currently associated with the instance. This method * is invoked when a client invokes a remove operation on the * enterprise Bean's home interface or the EJB object's remote interface. * This method transitions the instance from the ready state to the pool * of available instances. */ public void ejbRemove() throws RemoveException, EJBException, RemoteException { try { final InitialContext jndiContext = new InitialContext(); final DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase"); final Connection con = ds.getConnection(); try { final PreparedStatement stmt = con.prepareStatement("delete from entity where id = ?"); try { stmt.setInt(1, primaryKey); stmt.executeUpdate(); } finally { stmt.close(); } } finally { con.close(); } } catch (final Exception e) { e.printStackTrace(); throw new javax.ejb.EJBException(e); } }
public void beforeDelete(final LifecycleEvent lifecycleEvent) { eventOccurred(lifecycleEvent); try { final Object bean = lifecycleEvent.getSource(); cmpCallback.ejbRemove((EntityBean) bean); } catch (final RemoveException e) { throw new PersistenceException(e); } }
private void ejbRemove(final EntityBean entityBean) throws RemoveException { if (entityBean == null) { throw new NullPointerException("entityBean is null"); } if (isDeleted(entityBean)) { return; } final ThreadContext callContext = createThreadContext(entityBean); callContext.setCurrentOperation(Operation.REMOVE); final ThreadContext oldCallContext = ThreadContext.enter(callContext); try { entityBean.ejbRemove(); } catch (final RemoteException e) { throw new EJBException(e); } finally { // clear relationships // todo replace with interface call when CmpEntityBean interface is added try { entityBean.getClass().getMethod("OpenEJB_deleted").invoke(entityBean); } catch (final Exception ignored) { // no-op } cancelTimers(callContext); ThreadContext.exit(oldCallContext); } }
@Override public void ejbRemove() throws RemoveException, EJBException, RemoteException { logger.info("ejbRemove"); }
@Override public void remove() throws RemoteException, RemoveException { logger.info("remove"); }
@Override public void remove() throws RemoveException, EJBException { logger.info("remove"); }
@Override protected void DeleteEntry(Property p) throws RemoveException { home.remove(new ProfilePropertyPK(profilename, p.getName())); }
@Override protected void DeleteEntry(ServiceProperty p) throws RemoveException { home.remove(new ServicePropertyPK(Serviceid, p.getName())); }
@Override protected void DeleteEntry(Property p) throws RemoveException { //System.out.println ("HostPropertySet::DeleteEntry "+hostid+" "+p.getName()); home.remove(new HostPropertyPK(hostid, p.getName())); }
@Override protected Object removeByPrimaryKey(final Method method, final Object[] args, final Object proxy) throws Throwable { throw new ApplicationException(new RemoveException("Session objects are private resources and do not have primary keys")); }
public void ejbRemove() throws RemoveException { }
protected Object removeByPrimaryKey(final Class interfce, final Method method, final Object[] args, final Object proxy) throws Throwable { throw new RemoveException("Session objects are private resources and do not have primary keys"); }
@Override protected Object removeByPrimaryKey(final Class interfce, final Method method, final Object[] args, final Object proxy) throws Throwable { throw new RemoveException("Session objects are private resources and do not have primary keys"); }
@Override public void ejbRemove(final EntityBean entity) throws RemoveException { CmpContainer.this.ejbRemove(entity); }
@Override public void ejbRemove() throws RemoveException, EJBException, RemoteException { }