//~ Methods ----------------------------------------------------------------
super.init( config );
__logger.info( "Initializing" );
try
{
Datastore ds = Hibernate.createDatastore( );
/* Classes */
load( Account.class, ds );
load( Category.class, ds );
load( Customer.class, ds );
load( Item.class, ds );
load( Order.class, ds );
load( OrderItem.class, ds );
load( Product.class, ds );
/* Hibernate properties */
__logger.info( "...loading: hibernate.properties" );
InputStream in = getClass( ).getClassLoader( ).getResourceAsStream( "hibernate.properties" );
Properties props = new Properties( );
props.load( in );
/* Session Factory */
__logger.info( "...initializing the Hibernate SessionFactory" );
SessionFactory sessionFactory = ds.buildSessionFactory( props );
config.getServletContext( ).setAttribute( SESSION_FACTORY_KEY, sessionFactory );
__logger.info( "Initialized" );
}
catch ( HibernateException h )
{
throw new ServletException( h );
}
catch ( IOException io )
{
throw new ServletException( "Unable to load: hibernate.properties", io );
}