Sql2Class is a function which transforms a Database table into a java Class
and writes a control class to interact with the database.
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. |
Sql2Class can take the necessary parameters from a property file sql2class.properties
or from the commandline.
The commandline overwrites parameters set in de sql2class.properties file. Use the parameter names to define the properties.
parameters passed to the commandline should be prefixed with --
if you use the full name or -
if you use the short name.
If the files you are generating are the same as the files at the supplied location and package no new files
will be generated. Look at the SqlClassWriter.isFileSame(File)
for the conditions.
- Version:
- 0.42 [Jan 30, 2007]
- Author:
- dennis@brains2b.nl
- See Also:
SqlClassWriter.isFileSame(File)
Field Summary |
static java.lang.String |
VERSIONID
|
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()
|
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 |
VERSIONID
public static final java.lang.String VERSIONID
- See Also:
- Constant Field Values
Sql2ClassConsole
public Sql2ClassConsole()
- Constructor
main
public static void main(java.lang.String[] args)
- main
- Parameters:
args
- String[], the commandline arguments
initialize
protected void initialize(java.util.Properties prop)
throws org.brains2b.console.ArgumentException
- initialize Sql2Class with the values from properties
- Parameters:
prop
- Properties, the properties containing the arguments for Sql2Class
- Throws:
ArgumentException,
- thrown if a property from the file does not
org.brains2b.console.ArgumentException
makeClass
protected void makeClass()
throws java.sql.SQLException,
org.brains2b.data.DataException
- Throws:
java.sql.SQLException
org.brains2b.data.DataException