ch.sahits.codegen.java.input.db
Class OracleConnection

java.lang.Object
  extended by ch.sahits.codegen.java.input.db.DBConnection
      extended by ch.sahits.codegen.java.input.db.OracleConnection
Direct Known Subclasses:
OracleConnectorModelGenerator

public class OracleConnection
extends DBConnection

This class handles the connection to a Oracle DB. It queries the DB for the structure of a table.

Since:
0.9.4
Author:
Andi Hotz, (c) 2008

Field Summary
 
Fields inherited from class ch.sahits.codegen.java.input.db.DBConnection
conn, db, host, password, port, product, schema, table, user
 
Constructor Summary
OracleConnection()
          Default constructor
 
Method Summary
protected  java.lang.Class convert2Java(java.lang.String type)
          Convert the corresponding Java type for a database type
protected  DataBaseTable createDataBaseTable()
          Create the DataBaseTable with product specific data
 java.lang.String getConnectionDriverClass()
          Retrieve the driver class name for the JDBC connection
 java.lang.String getConnectionString()
          Retrieve the connection String for the specific database
protected  java.lang.String getConstraintFieldSQL(java.lang.String constraintName)
          Retrieve the SQL that gets you all fields of a constraint
protected  java.lang.String getIndexConstraintSQL()
          Retrieve the SQL that gets you the Index constraints
protected  DataBaseTable getStructure()
          Query the INFORMATION_SCHEMA to retrieve the metadata
protected  java.lang.String getTableSQL()
          Retrieve the SQL that gets you the table definition
protected  boolean isAutogenKey(java.lang.String fieldName)
          Check if a trigger is defined for the field on insert that referres to a sequence that fills the field.
protected  void loadDriver()
          check if the driver is available
 
Methods inherited from class ch.sahits.codegen.java.input.db.DBConnection
addFields2Index, getConstraintsFields, getPort, getSchema, init, isAutGenKey, setHost, setPassword, setPort, setProduct, setSchema, setTableName, setUserName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OracleConnection

public OracleConnection()
Default constructor

Method Detail

getStructure

protected final DataBaseTable getStructure()
                                    throws java.sql.SQLException
Query the INFORMATION_SCHEMA to retrieve the metadata

Overrides:
getStructure in class DBConnection
Returns:
DataBaseTable
Throws:
java.sql.SQLException

getConnectionString

public final java.lang.String getConnectionString()
Retrieve the connection String for the specific database

Specified by:
getConnectionString in class DBConnection
Returns:
connection string

loadDriver

protected final void loadDriver()
                         throws java.lang.ClassNotFoundException
check if the driver is available

Specified by:
loadDriver in class DBConnection
Throws:
java.lang.ClassNotFoundException - JDBC driver not on classpath

getConnectionDriverClass

public final java.lang.String getConnectionDriverClass()
Retrieve the driver class name for the JDBC connection

Returns:
fully qualified driver class name
Since:
1.2.0

convert2Java

protected final java.lang.Class convert2Java(java.lang.String type)
Convert the corresponding Java type for a database type

Specified by:
convert2Java in class DBConnection
Parameters:
type - database type
Returns:
Java type

createDataBaseTable

protected final DataBaseTable createDataBaseTable()
Create the DataBaseTable with product specific data

Specified by:
createDataBaseTable in class DBConnection
Returns:
new DataBaseTable
Since:
0.9.5

getConstraintFieldSQL

protected final java.lang.String getConstraintFieldSQL(java.lang.String constraintName)
Retrieve the SQL that gets you all fields of a constraint

Specified by:
getConstraintFieldSQL in class DBConnection
Parameters:
constraintName - name of the constraint
Returns:
SQL
Since:
0.9.5

getIndexConstraintSQL

protected final java.lang.String getIndexConstraintSQL()
Retrieve the SQL that gets you the Index constraints

Specified by:
getIndexConstraintSQL in class DBConnection
Returns:
SQL
Since:
0.9.5

getTableSQL

protected final java.lang.String getTableSQL()
Retrieve the SQL that gets you the table definition

Specified by:
getTableSQL in class DBConnection
Returns:
SQL
Since:
0.9.5

isAutogenKey

protected final boolean isAutogenKey(java.lang.String fieldName)
Check if a trigger is defined for the field on insert that referres to a sequence that fills the field. "http://webxadmin.free.fr/article/oracle-autoincrement-columns-134.php"

Parameters:
fieldName - name of the field
Returns:
true if such a trigger exists.
Since:
1.2.0