com.ihr.xbrl.manage
Class DbUtil

java.lang.Object
  extended by com.ihr.xbrl.manage.DbUtil

public class DbUtil
extends java.lang.Object

This class is responsible to initialize the Hibernate SessionFactory that will be used in obtaining objects from the XBRL Database.

Author:
Ignacio

Nested Class Summary
static class DbUtil.Database
          Enumerates the different database engines the storage subsystem can work with.
 
Constructor Summary
DbUtil(java.util.Properties properties)
          Creates a new instance of the DbUtil object.
 
Method Summary
 DbUtil.Database getDatabaseType()
          Reads the properties of this DBconnection and sets the database subsystem to the appropriate type.
static java.lang.String getDialect(DbUtil.Database database)
           
static java.lang.String getDriver(DbUtil.Database database)
           
 java.lang.Exception getLastException()
           
 org.hibernate.SessionFactory getSessionFactory(RegisterExtraClasses[] registers)
          gets or creates a session factory.
 boolean isDatabaseAvailable()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbUtil

public DbUtil(java.util.Properties properties)
Creates a new instance of the DbUtil object. Applications should not create instances of this object because the creator of XBRLDatabaseAccessApp already creates the instance of DbUtil object.

Parameters:
properties - Properties object. Extra properties for the Hibernate connection to the database.
Method Detail

getSessionFactory

public org.hibernate.SessionFactory getSessionFactory(RegisterExtraClasses[] registers)
gets or creates a session factory. If the session factory does not exist it is created and stored for later use.

The parameter is optional (can be null), if supplied it is an array of objects that implements the RegisterExtraClasse interface and this causes the configuration object to load more classes in the data model.

Returns null in case there are Hibernate exceptions during the connection to the database.

Parameters:
registers - Optional parameter, can be null.
Returns:
SessionFactory suitable for generating sessions

getDatabaseType

public DbUtil.Database getDatabaseType()
Reads the properties of this DBconnection and sets the database subsystem to the appropriate type.

Returns:
Database

isDatabaseAvailable

public boolean isDatabaseAvailable()

getLastException

public java.lang.Exception getLastException()

getDriver

public static java.lang.String getDriver(DbUtil.Database database)
Parameters:
oracle -
Returns:

getDialect

public static java.lang.String getDialect(DbUtil.Database database)
Parameters:
oracle -
Returns:


Copyright 2006-2009 Reporting Standard S.L., C/ Torrecilla del Puerto 1, 28043, Madrid, Espaņa