org.unitils.orm.hibernate.util
Class HibernateSpringSupport
java.lang.Object
org.unitils.orm.hibernate.util.HibernateSpringSupport
- All Implemented Interfaces:
- OrmSpringSupport<org.hibernate.SessionFactory,org.hibernate.cfg.Configuration>
public class HibernateSpringSupport
- extends Object
- implements OrmSpringSupport<org.hibernate.SessionFactory,org.hibernate.cfg.Configuration>
A support class containing Hibernate and HibernateModule
related actions for the SpringModule
.
This support class is only loaded if both the HibernateModule
and SpringModule
are loaded.
By encapsulating these operations, we remove the strong dependency to spring and the SpringModule
from
the HibernateModule
. This way, the HibernateModule
will still function if spring is not used.
- Author:
- Tim Ducheyne, Filip Neven
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HibernateSpringSupport
public HibernateSpringSupport()
isPersistenceUnitConfiguredInSpring
public boolean isPersistenceUnitConfiguredInSpring(Object testObject)
- Specified by:
isPersistenceUnitConfiguredInSpring
in interface OrmSpringSupport<org.hibernate.SessionFactory,org.hibernate.cfg.Configuration>
- Parameters:
testObject
- The test instance, not null
- Returns:
- True if an
ApplicationContext
is associated with the given test object,
and if a persistence unit of the type supported by this interface's implementation is available
getConfiguredPersistenceUnit
public ConfiguredOrmPersistenceUnit<org.hibernate.SessionFactory,org.hibernate.cfg.Configuration> getConfiguredPersistenceUnit(Object testObject)
- Specified by:
getConfiguredPersistenceUnit
in interface OrmSpringSupport<org.hibernate.SessionFactory,org.hibernate.cfg.Configuration>
- Parameters:
testObject
- The test instance, not null
- Returns:
- An instance of
ConfiguredOrmPersistenceUnit
that wraps the persistence unit and the
configuration object
getSessionFactoryBean
protected org.springframework.orm.hibernate3.LocalSessionFactoryBean getSessionFactoryBean(Object testObject)
- Parameters:
testObject
- The test instance, not null
- Returns:
- Instance of
LocalSessionFactoryBean
that wraps the configuration of hibernate in spring
getSpringModule
protected SpringModule getSpringModule()
- Returns:
- The Spring module, not null
Copyright © 2011. All Rights Reserved.