Develop > Persistence layer


Delete data using an access bean

You can delete data from the WebSphere Commerce database in your business logic using the remove() method on the access bean's EJB remote interface.

The EJB remote interface can be obtained by using the getEJBRef() method on the access bean.

The following example attempts to delete the record that is contained in myAccessBean.

// Delete record using an AccessBean
try 
{
    myAccessBean.getEJBRef().remove(); }
catch( ObjectNotFoundException e) {
    // Tried to delete a record that does not exist
    TypedProperty exceptionNVPS = new TypedProperty();     exceptionNVPS.put( ECConstants.EC_ERROR_CODE, EAConstants.ERR_CODE_RECORD_NOT_FOUND);     throw new ECApplicationException(ECMessage._ERR_ENTITY_OBJECT_NOT_FOUND, CLASS_NAME, "myMethodName", 
                    ECMessageHelper.generateMsgParms(istrEntity), istrEntityErrTaskName, exceptionNVPS); }


Related concepts

Find data using an access bean

Insert data using access beans

Access beans


+

Search Tips   |   Advanced Search