|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.brains2b.console.Main | +--org.brains2b.sql.toclass.Sql2ClassConsole
Console Application for running Sql2Class
Sql2Class is a function which transforms a Database table into a java Class and writes a control class to interact with the database.
Sql2Class takes a number of parameters:
parameter | short formrequired | description | |||||||
---|---|---|---|---|---|---|---|---|---|
driver | d | yes | qualified class name of the JDBC driver to use | ||||||
url | r | yes | JDBC url to connect to the datasoource | ||||||
user | u | no | username for the datasource, required only if JDBC connection requires it | ||||||
password | p | no | password for the datasource, required only if JDBC connection requires it | ||||||
table | t | yes | The table or view you want to generate | ||||||
location | l | no | the path where to write the newly generated classes to. The package name will be appended to the end of this location. If no location is defined the directory where Sql2Class was started is used | ||||||
package | g | no | The package for this class. This will be both set in de class files as used to append to the path as directory to create the classes in. | ||||||
readonly | w | no | Define that the control should be generated to as read-only | ||||||
optimistic | o | no | Use the OptimisticLocking and control code to identify the data class as using optimistic locking. No locking mechanisme is providided if this is not set | ||||||
forcerowid | f | no | Use a provided unique row identification instead of primary keys, or unique indexes to generate the data control. If there are no primary keys or unique indexes this option will be used by default. |
Field Summary | |
static java.lang.String |
VERSIONID
|
Constructor Summary | |
Sql2ClassConsole()
Constructor |
Method Summary | |
protected void |
initialize(java.util.Properties prop)
initialize Sql2Class with the values from properties |
static void |
main(java.lang.String[] args)
main |
protected void |
makeClass()
the method which actually creates the classes |
Methods inherited from class org.brains2b.console.Main |
getArgument, getArgumentMap, handleException, makeArgumentList, setArgument, setArgumentMap |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String VERSIONID
Constructor Detail |
public Sql2ClassConsole()
only sets the argument map to use for this application
Method Detail |
public static void main(java.lang.String[] args)
args
- String[], the commandline argumentsprotected void initialize(java.util.Properties prop) throws org.brains2b.console.ArgumentException
prop
- Properties, the properties containing the arguments for Sql2Class
ArgumentException,
- thrown if a property from the file does not
org.brains2b.console.ArgumentException
protected void makeClass() throws java.sql.SQLException
This method checks first if the files exists and are the same as the classes which are to be created. If new classes are to be created the table is looked up in the database and two seperate threads are started to create the data class and the data control class
SQLException,
- thrown if the JDBC connection
cannot complete normally
java.sql.SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |