org.perfectjpattern.jee.integration.dao
Class HibernateDaoFactory

java.lang.Object
  extended by org.perfectjpattern.jee.integration.dao.AbstractDaoFactory
      extended by org.perfectjpattern.jee.integration.dao.HibernateDaoFactory
All Implemented Interfaces:
IAbstractFactory, ISingleton, IBaseDaoFactory, IGenericDaoFactory
Direct Known Subclasses:
LocalDaoFactory

public class HibernateDaoFactory
extends AbstractDaoFactory
implements IGenericDaoFactory

Concrete implementation for IGenericDaoFactory

Version:
$ $Date: Dec 5, 2008 5:11:45 PM $
Author:
Giovanni Azua
 

Constructor Summary
protected HibernateDaoFactory()
          Defaults to JSE mode
protected HibernateDaoFactory(ISessionStrategy aSessionStrategy, ITransactionStrategy aTransactionStrategy)
          Constructs HibernateDaoFactory to consume Session instances from the given ISessionStrategy and Transaction instances from the ITransactionStrategy
 
Method Summary
<Id extends Serializable,Element>
IGenericDao<Id,Element>
createDao(Class<Element> aPersistentClass)
          Returns the Base DAO implementation corresponding to the given model class type.
protected
<Id extends Serializable,Element>
IGenericDao<Id,Element>
createDao(Class<Element> aPersistentClass, ISessionStrategy aSessionStrategy, ITransactionStrategy aTransactionStrategy)
           
<Id extends Serializable,Element>
IGenericReadOnlyDao<Id,Element>
createReadOnlyDao(Class<Element> aPersistentClass)
          Returns the Base Read-Only DAO implementation corresponding to the given model class type.
static HibernateDaoFactory getInstance()
          Returns Singleton instance of HibernateDaoFactory
 
Methods inherited from class org.perfectjpattern.jee.integration.dao.AbstractDaoFactory
setDaoSessionStrategy, setDaoTransactionStrategy, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.perfectjpattern.jee.api.integration.dao.IBaseDaoFactory
setDaoSessionStrategy, setDaoTransactionStrategy, shutdown
 

Constructor Detail

HibernateDaoFactory

protected HibernateDaoFactory(ISessionStrategy aSessionStrategy,
                              ITransactionStrategy aTransactionStrategy)
                       throws IllegalArgumentException
Constructs HibernateDaoFactory to consume Session instances from the given ISessionStrategy and Transaction instances from the ITransactionStrategy

Parameters:
aSessionStrategy - ISessionStrategy to consume Session instances from
aTransactionStrategy - ITransactionStrategy to consume Transaction instances from
Throws:
IllegalArgumentException - 'aDaoSessionStrategy' must not be null
IllegalArgumentException - 'aDaoTransactionStrategy' must not be null

HibernateDaoFactory

protected HibernateDaoFactory()
Defaults to JSE mode

Method Detail

getInstance

public static HibernateDaoFactory getInstance()
Returns Singleton instance of HibernateDaoFactory

Returns:
Singleton instance of HibernateDaoFactory

createReadOnlyDao

public <Id extends Serializable,Element> IGenericReadOnlyDao<Id,Element> createReadOnlyDao(Class<Element> aPersistentClass)
                                                                       throws IllegalArgumentException
Returns the Base Read-Only DAO implementation corresponding to the given model class type. Provides a generic and reusable means to create cached DAO instances.

Specified by:
createReadOnlyDao in interface IBaseDaoFactory
Specified by:
createReadOnlyDao in interface IGenericDaoFactory
Overrides:
createReadOnlyDao in class AbstractDaoFactory
Type Parameters:
Id - Id type
Element - Element type
Parameters:
aPersistentClass - Data model class type
Returns:
Base DAO implementation corresponding to the given model class type
Throws:
IllegalArgumentException - 'aPersistentClass' must not be null

createDao

public <Id extends Serializable,Element> IGenericDao<Id,Element> createDao(Class<Element> aPersistentClass)
                                                       throws IllegalArgumentException
Returns the Base DAO implementation corresponding to the given model class type. Provides a generic and reusable means to create cached DAO instances.

Specified by:
createDao in interface IBaseDaoFactory
Specified by:
createDao in interface IGenericDaoFactory
Overrides:
createDao in class AbstractDaoFactory
Type Parameters:
Id - Id type
Element - Element type
Parameters:
aPersistentClass - Data model class type
Returns:
Base DAO implementation corresponding to the given model class type
Throws:
IllegalArgumentException - 'aPersistentClass' must not be null

createDao

protected <Id extends Serializable,Element> IGenericDao<Id,Element> createDao(Class<Element> aPersistentClass,
                                                                              ISessionStrategy aSessionStrategy,
                                                                              ITransactionStrategy aTransactionStrategy)
Specified by:
createDao in class AbstractDaoFactory


Copyright © 2007-2009. All Rights Reserved.