| Types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| The Type Object holds properties about a particular type, in the database.
Each column can access it's own |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Basic Types JGenerator has a complete set of basic SQL Type mappings. The mappings between SQL and Java are enumerated below
N.B. The sql.types have been added to for NVARCHAR, which are used to represent unicode characters. Each type is treated as a seperate type in the dictionary. The type name
is used to specify generic type names |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Java Types The following Java type information is held on the dictionary for each type to help generate the code.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
SQL Types The following canonical database naming is written, using the vendor.getCanonicalName(type) method.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
User Types User Types can be used to define types in the property files, such as integers. The user type is decoration which can be used to hang other properties, usch as validation rules. The syntax for defining a UserType using the following syntax: - <user Type Name>.userType=<Type Name> For example: - POSITIVE_INT.userType=INTEGER This user type can then be set on the column as a type, for example: - Person.readColumn.2=age POSITIVE_INT NOT NULL The userType for a Column can be accessed as a property on the Column Bean. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Writing Example Types can be used to write our information about the underlying property and column types. Print the fully qualified name of the underlying java primitive type: - writer.print( column.getType().getJavaClass().getName() ); Print the fully qualified name of the underlying java object type: - writer.print( column.getType().getJavaObject().getName() ); Print the short name of the underlying java primitvetype: - writer.print( column.getType().getJavaClassName() ); Print the short name of the underlying java object type: - writer.print( column.getType().getJavaObjectName() ); Print the short name of the type for a Bean, this will print the Bean, Object, Enumerated Type or primitive type: - writer.print( column.getLogicalTypeName() ); Print the short name of the type for the jdbc mapping, this will be an object or a primitive type: - writer.print( column.getPhysicalTypeName() ); Print a sql vendors canonical name for a type: - writer.print( column.getVendor().getCanonicalName( column.getType() ) ); |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||