+

Search Tips   |   Advanced Search

 

Command interface example application

 

 

ModifyCheckingAccountCmd command interface

This example uses an entity bean with container-managed persistence (CMP), called CheckingAccountBean, which enables a client to deposit money, withdraw money, set a balance, get a balance, and retrieve the name on the account. This entity bean also accepts commands from the client. The code examples illustrate the command-related programming. For a servlet-based example, see Example: Writing a command target (client-side adapter)

This command is both targetable and compensable, so the interface extends both TargetableCommand and CompensableCommand interfaces.

... import com.ibm.websphere.exception.*; import com.ibm.websphere.command.*; public interface ModifyCheckingAccountCmd extends TargetableCommand, CompensableCommand { float getAmount(); float getBalance(); float getOldBalance(); // Used for compensating float setBalance(float amount); float setBalance(int amount);
CheckingAccount getCheckingAccount(); void setCheckingAccount(CheckingAccount newCheckingAccount);
TargetPolicy getCmdTargetPolicy();
...
}



 

Related tasks


Writing command interfaces

 

Related Reference


TargetableCommand interface
CompensableCommand interface

 

Reference topic