blob: 6f50a76f4869d02f0806955b35ff3d277e54418f [file] [log] [blame]
#if ($table.package != "")
package ${table.package};
#end
import java.io.Serializable;
import javax.persistence.*;
${table.importStatements}
/**
* The persistent class for the ${table.name} database table.
*
*/
@Entity
#if( !${table.defaultname} || $customizer.generateDDLAnnotations)
@Table(name="${table.name}")
#end
public class ${table.className} ${table.generateExtendsImplements()} {
private static final long serialVersionUID = 1L;
#####
##### fields
#####
#if ($table.compositeKey)
#if ($table.access == "field")
@EmbeddedId
#end
private ${table.compositeKeyClassName} ${table.compositeKeyPropertyName};
#end
#foreach ($column in $table.getSimpleColumns(true, true, false))
#if ($table.access == "field")
#parse("mappingKind.vm")
#parse("column.vm")
#end
${column.fieldScope} ${column.simplePropertyType} ${column.propertyName};
#end
#foreach ($role in $table.associationRoles)
#####
##### field annotations
#####
#if ($table.access == "field")
//${role.description}
#if ($role.cardinality == "many-to-one")
#parse("manyToOne.vm")
#elseif ($role.cardinality == "many-to-many")
#parse("manyToMany.vm")
#elseif ($role.cardinality == "one-to-many")
#parse("oneToMany.vm")
#elseif ($role.cardinality == "one-to-one")
#parse("oneToOne.vm")
#end
#end
#####
##### field declaration
#####
#if ($role.cardinality == "many-to-one" || $role.cardinality == "one-to-one")
#set ($propertyType = ${role.referencedTable.className})
#elseif ($role.cardinality == "many-to-many" || $role.cardinality == "one-to-many")
#set ($propertyType = "${role.referencedTable.simpleCollectionType}<${role.referencedTable.className}>")
#end
private $propertyType $role.propertyName;
#end
public ${table.className}() {
}
#####
##### simple properties getters and setters
#####
#if ($table.compositeKey)
#if ($table.access == "property")
@EmbeddedId
#end
public $table.compositeKeyClassName $customizer.propertyGetter($table.compositeKeyPropertyName)() {
return this.${table.compositeKeyPropertyName};
}
public void $customizer.propertySetter($table.compositeKeyPropertyName)($table.compositeKeyClassName $table.compositeKeyPropertyName) {
this.${table.compositeKeyPropertyName} = ${table.compositeKeyPropertyName};
}
#end
#foreach ($column in $table.getSimpleColumns(true, true, false))
#if ($table.access == "property")
#parse("mappingKind.vm")
#parse("column.vm")
#end
$column.propertyGetScope $column.simplePropertyType $customizer.propertyGetter($column.propertyName)() {
return this.${column.propertyName};
}
$column.propertySetScope void $customizer.propertySetter($column.propertyName)($column.simplePropertyType $column.propertyName) {
this.${column.propertyName} = ${column.propertyName};
}
#end
#####
##### associations getters and setters
#####
#foreach ($role in $table.associationRoles)
#if ($table.access == "property")
//${role.description}
#if ($role.cardinality == "many-to-one")
#parse("manyToOne.vm")
#elseif ($role.cardinality == "many-to-many")
#parse("manyToMany.vm")
#elseif ($role.cardinality == "one-to-many")
#parse("oneToMany.vm")
#elseif ($role.cardinality == "one-to-one")
#parse("oneToOne.vm")
#end
#end
##
#if ($role.cardinality == "many-to-one" || $role.cardinality == "one-to-one")
#set ($propertyType = $role.referencedTable.className)
#elseif ($role.cardinality == "many-to-many" || $role.cardinality == "one-to-many")
#set ($propertyType = "${role.referencedTable.simpleCollectionType}<${role.referencedTable.className}>")
#end
public $propertyType $customizer.propertyGetter($role.propertyName)() {
return this.${role.propertyName};
}
public void ${customizer.propertySetter($role.propertyName)}($propertyType $role.propertyName) {
this.${role.propertyName} = $role.propertyName;
}
##
#end
##
}