| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A Java tool to generate Lombok wired JPA entities from DDL statements. The tool offers both a maven plugin library and a JAR to be run as a standalone tool. It internally uses JSqlParser to parse the DDL statements.
The tool can generate the following,
and much more!
sqlscript2jpa-codegen is available at Maven Central Repository. To use it, simply declare the following plugins in your pom file:
<plugins>
<plugin>
<groupId>io.github.ngbsn</groupId>
<artifactId>sqlscript2jpa-codegen-maven-plugin</artifactId>
<version>${latest-version-from-maven-central}</version>
<executions>
<execution>
<id>parse-schema</id>
<phase>generate-sources</phase>
<goals>
<goal>parse-schema</goal>
</goals>
<configuration>
<sqlFilePath>${basedir}/src/main/resources/sql/organization.sql</sqlFilePath>
<packageName>org.mycompany.entities</packageName>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources/sqlscript2jpa/src/main/java/</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Also, you would need to add lombok to your dependencies:
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.28</version>
<scope>provided</scope>
</dependency>sqlFilePath: Path to the SQL file containing the DDL statements.
packageName: The package name for the generated entities.
By default, the source code will be generated under target/generated-sources/sqlscript2jpa
Get the JAR from https://repo1.maven.org/maven2/io/github/ngbsn/sqlscript2jpa-codegen-maven-plugin/1.0.6/sqlscript2jpa-codegen-maven-plugin-1.0.6-standalone.jar
java -jar sqlscript2jpa-codegen-maven-plugin-1.0.6-standalone.jar "<sql_file_path>" "<package_name>"
This will generate the JPA entities in a folder structure as defined by the package name under ./target/generated-sources/sqlscript2jpa
| Back | FazBrowse Home | New Git URL |