Deleting an Entity

A client can call either of the two remove methods of the home interface or the component interface’s remove to delete an entity object. The container responds to this request by calling your ejbRemove method for the instance that needs to be deleted. You’re responsible for doing whatever is necessary to remove the entity from the database within this method. Listing 6.13 shows the ejbRemove method for EnglishAuctionBean.

Listing 6.13. ejbRemove–A BMP ejbRemove Method Deletes an Entity from the Database
 package com.que.ejb20.auction.model; ... public class EnglishAuctionBean extends AbstractEntity implements EntityBean { ... public void ejbRemove() throws RemoveException { // an open auction has to be closed or cancelled ...

Get Special Edition Using Enterprise JavaBeans™ 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.