jhomenet.dao.hibernate
Class HibernateDAOFactory

java.lang.Object
  extended by jhomenet.dao.DAOFactory
      extended by jhomenet.dao.hibernate.HibernateDAOFactory

public class HibernateDAOFactory
extends DAOFactory

Returns Hibernate-specific instances of DAOs.

One of the responsiblities of the factory is to inject a Hibernate Session into the DAOs. You can customize the getCurrentSession() method if you are not using the default strategy, which simply delegates to Hibernates built-in "current Session" mechanism.

If for a particular DAO there is no additional non-CRUD functionality, we use an inner class to implement the interface in a generic way. This allows clean refactoring later on, should the interface implement business data access methods at some later time. Then, we would externalize the implementation into its own first-level class. We can't use anonymous inner classes for this trick because they can't extend or implement an interface and they can't include constructors.

Author:
christian.bauer@jboss.com, David Irwin

Field Summary
 
Fields inherited from class jhomenet.dao.DAOFactory
DEFAULT, HIBERNATE
 
Constructor Summary
HibernateDAOFactory()
           
 
Method Summary
 AbstractResponseDAO getAbstractResponseDAO()
           
protected  Session getCurrentSession()
           
 HardwareDataDAO getHardwareDataDAO()
           
 HomenetHardwareDAO getHomenetHardwareDAO()
           
 PlanDAO getPlanDAO()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateDAOFactory

public HibernateDAOFactory()
Method Detail

getHomenetHardwareDAO

public HomenetHardwareDAO getHomenetHardwareDAO()
Specified by:
getHomenetHardwareDAO in class DAOFactory
Returns:
A reference to a jHomenet hardware DAO
See Also:
DAOFactory.getHomenetHardwareDAO()

getHardwareDataDAO

public HardwareDataDAO getHardwareDataDAO()
Specified by:
getHardwareDataDAO in class DAOFactory
Returns:
A reference to a hardware data DAO
See Also:
DAOFactory.getHardwareDataDAO()

getPlanDAO

public PlanDAO getPlanDAO()
Specified by:
getPlanDAO in class DAOFactory
Returns:
A reference to a responsive plan DAO
See Also:
DAOFactory.getPlanDAO()

getAbstractResponseDAO

public AbstractResponseDAO getAbstractResponseDAO()
Specified by:
getAbstractResponseDAO in class DAOFactory
Returns:
A reference to an abstract responsive response DAO
See Also:
DAOFactory.getAbstractResponseDAO()

getCurrentSession

protected Session getCurrentSession()


Copyright © 2004-2005 David Irwin. All Rights Reserved.