http://www.fawcette.com/javapro/archives/bs0999/ posted by chsh.

Well, my application works somehow similar like this.
If you're using an ATM to transfer funds between your savings and checking accounts, at some point, the amount being transferred is subtracted from one account (step 1) and added to the other (step 2).
I will briefly describe the classes in my application what it does:

Database.java, a generic database class used by all classes performing database operations.
NewController.java, a specific class responsible for creating a customer record.
Customer.java, this class contain all the sql statements for /insert/update/delete/select operations.
Account.java, this class contain all the sql statements for /insert/update/delete/select operations.

the flow of my application

my Servlet would request all the information from the jsp page. For example

Code:
String name = request.getParameter("customerName");
String accountId = request.getParameter("accountId");

Customer customer = new Customer(name);
Account account = new Account(accountId);

NewController controller = new NewController(customer, account);
In my NewController class, i will call the methods in the Customer and Account class
Code:
public NewController(Customer c, Account a)
{
   c.createCustomer();
   a.createAccount();
}
So in my Customer and Account class
Code:
public void createCustomer()
{
   Database db = new Database();
   db.executeUpdate("insert into blah blah blah"):
}
In this case, whenever i create a new customer record, i need to create a account for the customer as well. But in any of the scenario, it may be the creation of the customer record fail, or the creation of the account record fail, how should i alter the structure of my application ?

Sorry for the bad english and my bad explanation