org.brains2b.sql.toclass
Class Sql2ClassConsole

java.lang.Object
  extended byorg.brains2b.console.Main
      extended byorg.brains2b.sql.toclass.Sql2ClassConsole

public class Sql2ClassConsole
extends org.brains2b.console.Main

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:

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.30 [Nov 4, 2003]
Author:
dennis@brains2b.nl
See Also:
SqlClassWriter#isFileSame(File)

parametershort formrequireddescription
driverdyesqualified class name of the JDBC driver to use
urlryesJDBC url to connect to the datasoource
userunousername for the datasource, required only if JDBC connection requires it
passwordpnopassword for the datasource, required only if JDBC connection requires it
tabletyesThe table or view you want to generate
locationlnothe 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
packagegnoThe 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.
readonlywnoDefine that the control should be generated to as read-only
optimisticonoUse the OptimisticLocking and control code to identify the data class as using optimistic locking. No locking mechanisme is providided if this is not set
forcerowidfnoUse 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()
           
 
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

VERSIONID

public static final java.lang.String VERSIONID
See Also:
Constant Field Values
Constructor Detail

Sql2ClassConsole

public Sql2ClassConsole()
Constructor

Method Detail

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
Throws:
java.sql.SQLException