Class GenerateSpringDataJpaClasses
java.lang.Object
com.northconcepts.datapipeline.foundations.tools.GenerateSpringDataJpaClasses
A utility class for generating Spring Data JPA entities and repositories using the metadata from a live database.
-
Constructor Summary
ConstructorsConstructorDescriptionGenerateSpringDataJpaClasses(JdbcConnection jdbcConnection, File baseFolder, String entityPackage, String repositoryPackage) -
Method Summary
Modifier and TypeMethodDescriptionvoidGenerates a JPA entity and aJpaRepositoryinterface for each table matching the givenDatabaseMetaData.getTablesarguments, writing files or printing them perisWriteToFile().Class<?> Returns the superclass of the generated entities, or null for none; generated record serialization also calls aRecordSerializablesuperclass.Returns the writer that receives the generated source when not writing files (standard output if not set).booleanIndicates if each generated entity includes a TemplateMasterFORM_DEFdescribing its columns (default false).booleanIndicates if entity class names are made singular, such asCustomerfor acustomerstable (default false).booleanIndicates if generated classes are written as files under the base folder instead of printed to the print writer (default true).setEntitySuperClass(Class<?> entitySuperClass) Sets the superclass of the generated entities, or null for none; generated record serialization also calls aRecordSerializablesuperclass.setIncludeTemplateMasterFormDef(boolean includeTemplateMasterFormDef) Indicates if each generated entity includes a TemplateMasterFORM_DEFdescribing its columns (default false).setMakeIdentifiersSingular(boolean makeIdentifiersSingular) Indicates if entity class names are made singular, such asCustomerfor acustomerstable (default false).setPrintWriter(PrintWriter printWriter) Sets the writer that receives the generated source when not writing files (standard output if not set).setWriteToFile(boolean writeToFile) Indicates if generated classes are written as files under the base folder instead of printed to the print writer (default true).
-
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 asCustomerfor acustomerstable (default false). -
setMakeIdentifiersSingular
Indicates if entity class names are made singular, such asCustomerfor acustomerstable (default false). -
getEntitySuperClass
Returns the superclass of the generated entities, or null for none; generated record serialization also calls aRecordSerializablesuperclass. -
setEntitySuperClass
Sets the superclass of the generated entities, or null for none; generated record serialization also calls aRecordSerializablesuperclass. -
isIncludeTemplateMasterFormDef
public boolean isIncludeTemplateMasterFormDef()Indicates if each generated entity includes a TemplateMasterFORM_DEFdescribing its columns (default false). -
setIncludeTemplateMasterFormDef
public GenerateSpringDataJpaClasses setIncludeTemplateMasterFormDef(boolean includeTemplateMasterFormDef) Indicates if each generated entity includes a TemplateMasterFORM_DEFdescribing its columns (default false). -
generate
public void generate(String catalog, String schemaPattern, String tableNamePattern, String... types) Generates a JPA entity and aJpaRepositoryinterface for each table matching the givenDatabaseMetaData.getTablesarguments, writing files or printing them perisWriteToFile(). -
getPrintWriter
Returns the writer that receives the generated source when not writing files (standard output if not set). -
setPrintWriter
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
Indicates if generated classes are written as files under the base folder instead of printed to the print writer (default true).
-