FileDocCategorySizeDatePackage
AccountPeer.javaAPI DocExample1280Fri Jan 31 06:27:42 GMT 1997bank.server

AccountPeer

public class AccountPeer extends imaginary.persist.DatabasePeer

Fields Summary
Constructors Summary
Methods Summary
protected java.lang.StringgetInsertSql(imaginary.persist.Persistent p)

	Account acct = (Account)p;
	int account_id = acct.getId();
	int cust_id = acct.getCustomerId();
	String type = acct.getAccountType();
	float balance = acct.getBalance();

	return "INSERT INTO t_accounts (account_id, cust_id, " +
	    "account_type, balance) " +
	    "VALUES( " + account_id + ", " + cust_id + ", '" + type + "', " +
	    balance + ")";
    
public java.lang.StringgetRemoveSql(imaginary.persist.Persistent p)

	int account_id = p.getId();

	return "DELETE FROM t_accounts WHERE account_id = " + account_id;
    
public java.lang.StringgetRestoreSql(imaginary.persist.Persistent p)

	return "SELECT * from t_accounts WHERE account_id = " +
	    p.getId();
    
public java.lang.StringgetUpdateSql(imaginary.persist.Persistent p)

	Account acct = (Account)p;
	int account_id = acct.getId();
	int cust_id = acct.getCustomerId();
	String type = acct.getAccountType();
	float balance = acct.getBalance();

	return "UPDATE t_accounts " +
	    "SET cust_id = " + cust_id + ", " +
	    "account_type = '" + type + "', " +
	    "balance = " + balance + " " +
	    "WHERE account_id = " + account_id;