public class Sql2ClassConsole
extends org.brains2b.console.Main
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. |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
VERSIONID |
| Constructor and Description |
|---|
Sql2ClassConsole()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
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() |
public static final java.lang.String VERSIONID
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 Sql2ClassArgumentException, - thrown if a property from the file does notorg.brains2b.console.ArgumentExceptionprotected void makeClass()
throws java.sql.SQLException,
org.brains2b.data.DataException
java.sql.SQLExceptionorg.brains2b.data.DataException