All Downloads are FREE. Search and download functionalities are using the official Maven repository.

entityGen.entity.ftl Maven / Gradle / Ivy

There is a newer version: 0.99.9
Show newest version
package ${packageName};

<#list importRules as rule>
import ${rule.importValue};


<#if classComment?has_content>
${classComment}

<#list classAnnotationRules as rule>
<#list rule.annotations as annotation>
${annotation.toString()}


<#-- NOTICE: the name attribute of @Table is intentionally unquoted  -->
@Table(name = "${tableName}")<#if primaryKeyFields.size() \gt 1>
@IdClass(${className}.PrimaryKeys.class)
public class ${className}<#if interfaceNames.size() \gt 0> implements ${interfaceNames?join(", ")} {
<#if primaryKeyFields.size() \gt 1>
  @Data
  public static class PrimaryKeys implements Serializable {
  <#list primaryKeyFields as field>
    private ${field.type} ${field.name}<#if field.defaultValue??> = ${field.defaultValue};
  
  }


<#list topAdditionalCodeList as code>
${code}


<#list fields as field>
<#if field.comment?has_content>
${field.comment}

<#if field.primaryKey>
  @Id

<#if field.autoIncrement>
  <#if field.generatedValueStrategy?has_content>
  @GeneratedValue(strategy = GenerationType.${field.generatedValueStrategy})
  <#else>
  @GeneratedValue
  

<#list field.annotations as annotation>
  ${annotation.toString()}

<#if requireJSR305 && !field.primitive>
  <#if field.nullable>@Nullable<#else>@Nonnull

  @Column(name = "<#if jpa1Compatible>`<#else>\"${field.columnName}<#if jpa1Compatible>`<#else>\"", nullable = ${field.nullable?c})
  private ${field.type} ${field.name}<#if field.defaultValue??> = ${field.defaultValue};

<#list bottomAdditionalCodeList as code>

${code}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy