package ${packageName}.model;
|
|
<#if hasDateColumns>
|
import java.util.Date;
|
|
</#if>
|
import javax.persistence.Column;
|
import javax.persistence.Entity;
|
import javax.persistence.GeneratedValue;
|
<#if pkFieldType == "Integer" || pkFieldType == "Long">
|
import javax.persistence.GenerationType;
|
</#if>
|
import javax.persistence.Id;
|
import javax.persistence.Table;
|
<#if hasVersionColumn>
|
import javax.persistence.Version;
|
</#if>
|
|
<#if hasLobColumns>
|
import org.hibernate.annotations.Type;
|
|
</#if>
|
import com.landy.framework.core.model.BaseModel;
|
<#if implementsOperationLog>
|
import com.landy.framework.core.model.OperationLog;
|
</#if>
|
|
/**
|
* Model class for ${label}
|
<#list remarkLines as remarkLine>
|
* ${remarkLine}
|
</#list>
|
*/
|
@Entity
|
@Table(name = "${tableName}")
|
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
|
public class ${className}Model extends BaseModel <#if implementsOperationLog>implements OperationLog </#if>{
|
|
<#list columns as column>
|
//${column.label}
|
private ${column.fieldType} ${column.fieldName};
|
</#list>
|
|
<#list columns as column>
|
/**
|
* Get ${column.label}
|
<#list column.remarkLines as remarkLine>
|
* ${remarkLine}
|
</#list>
|
*/
|
@Column(name = "${column.columnName}")
|
<#if column.isPK>
|
<#if pkFieldType == "String">
|
@Id @GeneratedValue(generator = "UUIDGenerator")
|
<#elseif pkFieldType == "Integer" || pkFieldType == "Long">
|
@Id @GeneratedValue(strategy=GenerationType.AUTO)
|
</#if>
|
</#if>
|
<#if column.columnType == "BLOB">
|
@Type(type="org.springframework.orm.hibernate3.support.BlobByteArrayType")
|
</#if>
|
<#if column.columnType == "CLOB">
|
@Type(type="org.springframework.orm.hibernate3.support.ClobStringType")
|
</#if>
|
<#if column.isVersion>
|
@Version
|
</#if>
|
public ${column.fieldType} ${column.getterMethodName}() {
|
return ${column.fieldName};
|
}
|
|
/**
|
* Set ${column.label}
|
<#list column.remarkLines as remarkLine>
|
* ${remarkLine}
|
</#list>
|
*/
|
public void ${column.setterMethodName}(${column.fieldType} ${column.fieldName}) {
|
this.${column.fieldName} = ${column.fieldName};
|
addValidField("${column.fieldName}");
|
}
|
|
</#list>
|
}
|