org.unitils.orm.hibernate
Class HibernateUnitils

java.lang.Object
  extended by org.unitils.orm.hibernate.HibernateUnitils

public class HibernateUnitils
extends Object

Utility facade for handling Hibernate related stuff such as asserting whether the mappings correspond to the actual structure of the database.

Author:
Filip Neven, Tim Ducheyne

Constructor Summary
HibernateUnitils()
           
 
Method Summary
static void assertMappingWithDatabaseConsistent()
          Checks if the mapping of the Hibernate managed objects with the database is still correct for the configurations that are loaded for the current test.
static void flushDatabaseUpdates()
          Flushes all pending Hibernate updates to the database.
static org.hibernate.Session getSession()
           
static org.hibernate.SessionFactory getSessionFactory()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateUnitils

public HibernateUnitils()
Method Detail

assertMappingWithDatabaseConsistent

public static void assertMappingWithDatabaseConsistent()
Checks if the mapping of the Hibernate managed objects with the database is still correct for the configurations that are loaded for the current test.


flushDatabaseUpdates

public static void flushDatabaseUpdates()
Flushes all pending Hibernate updates to the database. This method is useful when the effect of updates needs to be checked directly on the database, without passing through the currently active hibernate session.


getSessionFactory

public static org.hibernate.SessionFactory getSessionFactory()
Returns:
The SessionFactory configured for the current test object (spring or using the HibernateSessionFactory annotation.

getSession

public static org.hibernate.Session getSession()
Returns:
A Session associated with the current transaction. This method returns the same Session during the course of a transaction.


Copyright © 2011. All Rights Reserved.