Class GenerateSpringDataJpaClasses

java.lang.Object
com.northconcepts.datapipeline.foundations.tools.GenerateSpringDataJpaClasses

public class GenerateSpringDataJpaClasses extends Object
A utility class for generating Spring Data JPA entities and repositories using the metadata from a live database.
  • Constructor Details

    • GenerateSpringDataJpaClasses

      public GenerateSpringDataJpaClasses(JdbcConnection jdbcConnection, File baseFolder, String entityPackage, String repositoryPackage)
  • Method Details

    • isMakeIdentifiersSingular

      public boolean isMakeIdentifiersSingular()
      Indicates if entity class names are made singular, such as Customer for a customers table (default false).
    • setMakeIdentifiersSingular

      public GenerateSpringDataJpaClasses setMakeIdentifiersSingular(boolean makeIdentifiersSingular)
      Indicates if entity class names are made singular, such as Customer for a customers table (default false).
    • getEntitySuperClass

      public Class<?> getEntitySuperClass()
      Returns the superclass of the generated entities, or null for none; generated record serialization also calls a RecordSerializable superclass.
    • setEntitySuperClass

      public GenerateSpringDataJpaClasses setEntitySuperClass(Class<?> entitySuperClass)
      Sets the superclass of the generated entities, or null for none; generated record serialization also calls a RecordSerializable superclass.
    • isIncludeTemplateMasterFormDef

      public boolean isIncludeTemplateMasterFormDef()
      Indicates if each generated entity includes a TemplateMaster FORM_DEF describing its columns (default false).
    • setIncludeTemplateMasterFormDef

      public GenerateSpringDataJpaClasses setIncludeTemplateMasterFormDef(boolean includeTemplateMasterFormDef)
      Indicates if each generated entity includes a TemplateMaster FORM_DEF describing its columns (default false).
    • generate

      public void generate(String catalog, String schemaPattern, String tableNamePattern, String... types)
      Generates a JPA entity and a JpaRepository interface for each table matching the given DatabaseMetaData.getTables arguments, writing files or printing them per isWriteToFile().
    • getPrintWriter

      public PrintWriter getPrintWriter()
      Returns the writer that receives the generated source when not writing files (standard output if not set).
    • setPrintWriter

      public GenerateSpringDataJpaClasses setPrintWriter(PrintWriter printWriter)
      Sets the writer that receives the generated source when not writing files (standard output if not set).
    • isWriteToFile

      public boolean isWriteToFile()
      Indicates if generated classes are written as files under the base folder instead of printed to the print writer (default true).
    • setWriteToFile

      public GenerateSpringDataJpaClasses setWriteToFile(boolean writeToFile)
      Indicates if generated classes are written as files under the base folder instead of printed to the print writer (default true).