org.synyx.hades.dao.orm
Class GenericDaoFactoryBean<T extends GenericDao<?,?>>

java.lang.Object
  extended by org.synyx.hades.dao.orm.GenericDaoFactory
      extended by org.synyx.hades.dao.orm.GenericDaoFactoryBean<T>
Type Parameters:
T - the type of the DAO
All Implemented Interfaces:
org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.FactoryBean<T>, org.springframework.beans.factory.InitializingBean

public class GenericDaoFactoryBean<T extends GenericDao<?,?>>
extends GenericDaoFactory
implements org.springframework.beans.factory.FactoryBean<T>, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.BeanFactoryAware

Special GenericDaoFactory adapter for Springs FactoryBean interface to allow easy setup of DAO factories via Spring configuration.

Author:
Oliver Gierke, Eberhard Wolff

Constructor Summary
GenericDaoFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
static
<T extends GenericDao<?,?>>
GenericDaoFactoryBean<T>
create(java.lang.Class<T> daoInterface, javax.persistence.EntityManager em)
          Creates a new GenericDaoFactoryBean.
 T getObject()
           
 java.lang.Class<? extends T> getObjectType()
           
 boolean isSingleton()
           
 void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
           
 void setCustomDaoImplementation(java.lang.Object customDaoImplementation)
          Setter to inject a custom DAO implementation.
 void setDaoInterface(java.lang.Class<T> daoInterface)
          Setter to inject the dao interface to implement.
 void setTransactionManager(java.lang.String transactionManager)
          Setter to configure which transaction manager to be used.
 
Methods inherited from class org.synyx.hades.dao.orm.GenericDaoFactory
create, getDao, getDao, getDaoClass, getEntityManager, setEntityManager, setQueryLookupStrategy, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericDaoFactoryBean

public GenericDaoFactoryBean()
Method Detail

create

public static <T extends GenericDao<?,?>> GenericDaoFactoryBean<T> create(java.lang.Class<T> daoInterface,
                                                                          javax.persistence.EntityManager em)
Creates a new GenericDaoFactoryBean.

Type Parameters:
T -
Parameters:
daoInterface -
em -
Returns:

setDaoInterface

public void setDaoInterface(java.lang.Class<T> daoInterface)
Setter to inject the dao interface to implement. Defaults to GenericDao.

Parameters:
daoInterface - the daoInterface to set

setTransactionManager

public void setTransactionManager(java.lang.String transactionManager)
Setter to configure which transaction manager to be used. We have to use the bean name explicitly as otherwise the qualifier of the Transactional annotation is used. By explicitly defining the transaction manager bean name we favour let this one be the default one chosen.

Parameters:
transactionManager -

setCustomDaoImplementation

public void setCustomDaoImplementation(java.lang.Object customDaoImplementation)
Setter to inject a custom DAO implementation. This class needs

Parameters:
customDaoImplementation - the customDaoImplementation to set

getObject

public T getObject()
Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean<T extends GenericDao<?,?>>

getObjectType

public java.lang.Class<? extends T> getObjectType()
Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean<T extends GenericDao<?,?>>

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface org.springframework.beans.factory.FactoryBean<T extends GenericDao<?,?>>

afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean

setBeanFactory

public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
Specified by:
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware


Copyright © 2009-2010 Synyx GmbH & Co. KG. All Rights Reserved.