A client deletes an entity bean by invoking the
remove
method. This invocation causes the EJB container to call the ejbRemove
method, which deletes the entity state from the database. In theSavingsAccountBean
class, the ejbRemove
method invokes a private method named deleteRow
, which issues a SQL DELETE
statement. The ejbRemove
method is short:public void ejbRemove() { try { deleteRow(id); catch (Exception ex) { throw new EJBException("ejbRemove: " + ex.getMessage()); } }
If the
ejbRemove
method encounters a system problem, it should throw the javax.ejb.EJBException
. If it encounters an application error, it should throw a javax.ejb.RemoveException
. An entity bean may also be removed directly by a database deletion. For example, if a SQL script deletes a row that contains an entity bean state, then that entity bean is removed.
No comments:
Post a Comment