|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.toften.jlips.persist.db.DBConnectionFactory
public final class DBConnectionFactory
This class act as a factory for database connections. Because
Constructor Summary | |
---|---|
DBConnectionFactory()
|
Method Summary | |
---|---|
static DBStatement |
createStatement()
Returns a new SQL statement from the statement manager |
static Connection |
getConnection()
Request a connection from the associated connection handler |
static DBProperties |
getDBProperties()
Get the DBProperties object |
static DBTableColumnInfo |
getPrimaryKeyField(DBTableInfo tableName)
Get the last primary key field name for the specified table |
static List |
getTableFields(DBTableInfo tableName)
Returns a List containing DBTableColumnInfo objects for all the
fields in the specified table |
static List |
getTableNames()
Returns a List containing DBTableInfo objects for all the
tables in the database |
static void |
init(DBProperties connectionProperties)
Initialises the database connectivity with provided DBProperties object. |
static void |
init(Map dbInitProp)
This method initialises the Database Connection Factory The method will validate, that all parameters has been supplied are correct. |
static void |
releaseConnection(Connection theConnection)
Release a requested connection After the application is done using the connection, it should invoke this method to inform the connection handler that it doesn't need the connection anymore |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DBConnectionFactory()
Method Detail |
---|
public static void init(Map dbInitProp) throws ClassNotFoundException, IllegalAccessException, InstantiationException, DBBadPropertiesException, SQLException
dbInitProp
- The database properties that was supplied
ClassNotFoundException
- Thrown if the classes specified in the database properties
could not be loaded or instantiated
IllegalAccessException
- See Class.forName(java.lang.String)
InstantiationException
- See Class.forName(java.lang.String)
DBBadPropertiesException
- Thrown if the properties provided to jLips are wrong
SQLException
- Thrown if the database metadata could not be readEntityFactory.init(Properties, Map)
public static void init(DBProperties connectionProperties) throws ClassNotFoundException, IllegalAccessException, InstantiationException, DBBadPropertiesException, SQLException
connectionProperties
- Database connection properties object
ClassNotFoundException
- Thrown if the classes specified in the database properties
could not be loaded or instantiated
IllegalAccessException
- See Class.newInstance()
InstantiationException
- See Class.newInstance()
DBBadPropertiesException
- Thrown if the properties provided to jLips are wrong
SQLException
- Thrown if the database metadata could not be readDEFAULT_CON
,
DEFAULT_STM
public static Connection getConnection() throws SQLException
Connection
object to the database
SQLException
DataSource.getConnection()
public static void releaseConnection(Connection theConnection)
theConnection
- The not needed connectionpublic static DBProperties getDBProperties()
public static List getTableNames() throws SQLException
DBTableInfo
objects for all the
tables in the database
SQLException
public static List getTableFields(DBTableInfo tableName) throws SQLException
DBTableColumnInfo
objects for all the
fields in the specified table
tableName
- The table info of the table
SQLException
public static DBTableColumnInfo getPrimaryKeyField(DBTableInfo tableName) throws SQLException
tableName
- The table info of the table
SQLException
public static DBStatement createStatement() throws InstantiationException, IllegalAccessException
InstantiationException
- See Class.newInstance()
IllegalAccessException
- See Class.newInstance()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |