com.laszlomarket
Class ProductDAO

java.lang.Object
  extended bycom.laszlomarket.ProductDAO

public class ProductDAO
extends java.lang.Object

Provides an interface used to access Product objects from the database using Hibernate.

Author:
Norman Klein

Field Summary
private static ProductDAO instance
           
private static org.apache.commons.logging.Log log
           
 
Constructor Summary
private ProductDAO()
           
 
Method Summary
 void addProduct(Product product)
          addProduct() inserts new Product into the database through Hibernate.
 void deleteProduct(Product product)
          deleteProduct() delete the specified Product from the database through Hibernate.
static ProductDAO getInstance()
          getInstance() returns the instance of the ProductDAO singleton.
 java.util.List getProduct(Product product)
          getProduct() returns Product object from database with given id.
 java.util.List getProducts(Product product)
          getProducts() returns list of all matching Product objects stored in the database.
 void updateProduct(Product product)
          updateProduct() updates specfied Product through Hibernate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log

instance

private static ProductDAO instance
Constructor Detail

ProductDAO

private ProductDAO()
Method Detail

getInstance

public static ProductDAO getInstance()
getInstance() returns the instance of the ProductDAO singleton.

Returns:
ProductDAO singleton.

getProduct

public java.util.List getProduct(Product product)
getProduct() returns Product object from database with given id. If the product is not found, then null is returned.

Returns:
Product with given id, if it exists. Otherwise, returns null.

updateProduct

public void updateProduct(Product product)
updateProduct() updates specfied Product through Hibernate.

Parameters:
product - A new Product to be added.

getProducts

public java.util.List getProducts(Product product)
getProducts() returns list of all matching Product objects stored in the database.

Returns:
List of Product objects.

addProduct

public void addProduct(Product product)
addProduct() inserts new Product into the database through Hibernate.

Parameters:
product - A new Product to be added.

deleteProduct

public void deleteProduct(Product product)
deleteProduct() delete the specified Product from the database through Hibernate.



Copyright 2003