doc.tables.table.ftl Maven / Gradle / Ivy
<#import "/doc/common.ftl" as common>
Hibernate Mappings - Table Info
<@common.header/>
Schema ${dochelper.getQualifiedSchemaName(table)}
Table ${table.name}
<#if table.comment?exists>
${table.comment}
#if>
Column Summary
Name
SqlType
Length
Precision
Scale
Nullable
Unique
<#foreach column in table.columnIterator>
${column.name}
${dochelper.getSQLTypeName(column)}
${column.length}
${column.precision}
${column.scale}
${column.nullable?string}
${column.unique?string}
#foreach>
<#-- SHOW THE PRIMARY KEY -->
Primary Key
Name
Columns
<#if table.hasPrimaryKey()>
<#if table.primaryKey.name?has_content>
${table.primaryKey.name}
<#else>
Name not specified
#if>
<#list table.primaryKey.columnIterator() as column>
${column.name}
#list>
<#else>
No Primary Key
#if>
<#-- SHOW THE FOREIGN KEYS -->
<#if table.foreignKeyIterator.hasNext()>
Foreign Keys
Name
Referenced Table
Columns
<#foreach foreignKey in table.foreignKeyIterator>
${foreignKey.name?default("Name not specified")}
${foreignKey.referencedTable.name}
<#foreach column in foreignKey.getColumnIterator()>
${column.name}
#foreach>
#foreach>
#if>
<#-- SHOW THE UNIQUE KEYS -->
<#if table.uniqueKeyIterator.hasNext()>
Unique Keys
Name
Columns
<#foreach uniqueKey in table.getUniqueKeyIterator()>
${uniqueKey.name?default("Name not specified")}
<#foreach column in uniqueKey.getColumnIterator()>
${column.name}
#foreach>
#foreach>
#if>
<#-- SHOW THE TABLE INDEXES -->
<#if table.indexIterator.hasNext()>
Indexes
Name
Columns
<#foreach index in table.indexIterator>
${index.name?default("Name not specificed")}
<#foreach column in index.columnIterator>
${column.name}
#foreach>
#foreach>
#if>
<#if table.columnIterator.hasNext()>
Column Detail
<#foreach column in table.columnIterator>
${column.name}
-
Type: ${dochelper.getSQLTypeName(column)}
-
Length: ${column.length}
-
Precision: ${column.precision}
-
Scale: ${column.scale}
-
Nullable: ${column.nullable?string}
-
Unique: ${column.unique?string}
-
Comment: ${column.comment?if_exists}
<#--
Mappings:
#foreach($property in $dochelper.getProperties($table, $column))
$property.persistentClass.className - $property.name
#end
-->
#foreach>
#if>