|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbiz.wedoit4u.databeans.CustomerHelper
final class CustomerHelper
A helper class that provides convenient methods to interact with
the customers table. This class is meant to
be used from the DatabaseHelper class, or other classes
in this package only.
Copyright 2003, Rakesh Vidyadharan and wedoit4u.biz
| Field Summary | |
|---|---|
(package private) static java.lang.String |
ALL_CUSTOMERS
The statement that is executed to fetch all the records from the customers table. |
(package private) static java.lang.String |
CUSTOMER_ID_SEQUENCE
The sequence set in the database for the
customer_id primary key column. |
(package private) static java.lang.String |
DELETE_CUSTOMERS
The delete statement to be executed to delete a record in the customers table identified by the primary key value. |
(package private) static java.lang.String |
FIND_BY_CUSTOMER_TYPE
The statement that is executed to fetch all the records in the customer table that belong to a specific
customer_type_id. |
(package private) static java.lang.String |
FIND_BY_USERNAME_AND_PASSWORD
The statement that is executed to fetch the matching record from the customer table for the specified username
value. |
(package private) static java.lang.String |
INSERT_CUSTOMERS
The statement that is executed to insert a new record into the customers table. |
(package private) static java.lang.String |
SELECT_CUSTOMERS
The statement that is executed to fetch a specific record from the customers table. |
(package private) static java.lang.String |
UPDATE_CUSTOMERS
The update statement to be executed to update a record in the customers table. |
| Constructor Summary | |
|---|---|
private |
CustomerHelper()
Default constructor. |
| Method Summary | |
|---|---|
(package private) static void |
delete(int customerId)
Delete the record from the database identified by the primary key value specified. |
(package private) static java.util.Collection |
findAll()
Return a Collection of Integer values
that represent all the primary key values in the
customers table. |
(package private) static java.util.Collection |
findByCustomerType(int customerTypeId)
Select specified records from the customers
table that belong to the specified customer_type_id. |
(package private) static int |
findByUsernameAndPassword(java.lang.String username,
java.lang.String password)
Select the record from the customers table that has
the specified username and password
values. |
(package private) static int |
insert(int customerId,
java.lang.String username,
java.lang.String password,
java.lang.String email,
java.lang.String domain,
char active,
java.util.Date activationDate,
java.util.Date expirationDate,
int customerTypeId)
Insert a new record into the customers table
with the values specified. |
(package private) static void |
select(CustomerBean cb)
Select the specified record from the customers
table. |
(package private) static void |
update(CustomerBean cb)
Update the values in the customers table with
the specified values. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static final java.lang.String CUSTOMER_ID_SEQUENCE
sequence set in the database for the
customer_id primary key column.
static final java.lang.String ALL_CUSTOMERS
customers table.
static final java.lang.String FIND_BY_CUSTOMER_TYPE
customer table that belong to a specific
customer_type_id.
static final java.lang.String FIND_BY_USERNAME_AND_PASSWORD
customer table for the specified username
value.
static final java.lang.String INSERT_CUSTOMERS
customers table.
static final java.lang.String SELECT_CUSTOMERS
customers table.
static final java.lang.String UPDATE_CUSTOMERS
customers table.
static final java.lang.String DELETE_CUSTOMERS
customers table identified by the primary key value.
| Constructor Detail |
|---|
private CustomerHelper()
| Method Detail |
|---|
static final java.util.Collection findAll()
throws java.sql.SQLException,
javax.naming.NamingException
Collection of Integer values
that represent all the primary key values in the
customers table.
java.sql.SQLException - - If errors are encountered while fetching
the records from the database.
javax.naming.NamingException - - If errors are encountered while getting
a connection from the connection pool.
static final java.util.Collection findByCustomerType(int customerTypeId)
throws java.sql.SQLException,
javax.naming.NamingException
customers
table that belong to the specified customer_type_id.
customerTypeId - - The customer_type_id value.
java.sql.SQLException - - If errors are encountered while fetching
the record from the database.
javax.naming.NamingException - - If errors are encountered while getting
a connection from the connection pool.
static final int findByUsernameAndPassword(java.lang.String username,
java.lang.String password)
throws java.sql.SQLException,
javax.naming.NamingException
customers table that has
the specified username and password
values.
username - - The username value.password - - The username value.
java.sql.SQLException - - If errors are encountered while fetching
the record from the database.
javax.naming.NamingException - - If errors are encountered while getting
a connection from the connection pool.
static final void select(CustomerBean cb)
throws java.sql.SQLException,
javax.naming.NamingException
customers
table. The values selected from the database are used to set the
values of the bean fields.
cb - - The java bean instance that
represents the record. The primary key value to use to look
up the record is obtained from this bean.
java.sql.SQLException - - If errors are encountered while fetching
the record from the database.
javax.naming.NamingException - - If errors are encountered while getting
a connection from the connection pool.
static final int insert(int customerId,
java.lang.String username,
java.lang.String password,
java.lang.String email,
java.lang.String domain,
char active,
java.util.Date activationDate,
java.util.Date expirationDate,
int customerTypeId)
throws java.sql.SQLException,
javax.naming.NamingException
customers table
with the values specified.
customerId - - The primary key values to use. If this
is 0, then the next value from the CUSTOMER_ID_SEQUENCE is used.username - - The username value.password - - The password value.email - - The email value.domain - - The domain value.active - - The active value.activationDate - - The activation_date value.expirationDate - - The expiration_date value.customerTypeId - - The customer_type_id
foreign key value.
java.sql.SQLException - - If database errors are encountered while
writing to the database.
javax.naming.NamingException - - If errors are encountered while getting
a connection from the connection pool.
static final void update(CustomerBean cb)
throws java.sql.SQLException,
javax.naming.NamingException
customers table with
the specified values.
cb - - The java bean that represents a
record in the database.
java.sql.SQLException - - If database errors are encountered while
writing to the database.
javax.naming.NamingException - - If errors are encountered while getting
a connection from the connection pool.
static final void delete(int customerId)
throws java.sql.SQLException,
javax.naming.NamingException
customerId - - The customer_id
primary key value.
java.sql.SQLException - - If database errors are encountered while
writing to the database.
javax.naming.NamingException - - If errors are encountered while getting
a connection from the connection pool.
|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||