11# sqlscript2jpa-codegen
22
3- A Java library to generate Lombok wired JPA entities from DDL statements. The library offers both a maven plugin and a
3+ A Java tool to generate Lombok wired JPA entities from DDL statements. The library offers both a maven plugin and a
44jar to be run as a standalone tool. It internally uses JSqlParser to parse the DDL statements.
55
6+ The tool can generate the following,
7+ - Entities for all tables having annotations @Table and @Column for table and column names respectively.
8+ - @OneToMany , @ManyToMany , @JoinColumn annotations for association mappings.
9+ - @Embeddable and @EmbeddedId for composite keys.
10+ - @MapsId for shared primary keys.
11+ - javax validation annotation @NotNull for the SQL NOT NULL Constraint.
12+ and much more!
13+
614### Getting Started
715
816## Prerequisites
@@ -14,6 +22,9 @@ jar to be run as a standalone tool. It internally uses JSqlParser to parse the D
1422 * CREATE TABLE
1523 * ALTER TABLE ADD CONSTRAINT PRIMARY KEY
1624 * ALTER TABLE ADD CONSTRAINT FOREIGN KEY
25+ * ALTER TABLE ADD COLUMN
26+ * ALTER TABLE DROP COLUMN
27+ 5 . Not all SQL Types are supported. Unsupported types get generated as Java Type ** Object** .
1728
1829## Maven
1930
@@ -84,10 +95,10 @@ By default, the source code will be generated under `target/generated-sources/sq
8495## Standalone
8596
8697Get the jar
87- from https://repo1.maven.org/maven2/io/github/ngbsn/sqlscript2jpa-codegen-maven-plugin/1.0.5/sqlscript2jpa-codegen-maven-plugin-1.0.5 -standalone.jar
98+ from https://repo1.maven.org/maven2/io/github/ngbsn/sqlscript2jpa-codegen-maven-plugin/1.0.5/sqlscript2jpa-codegen-maven-plugin-1.0.6 -standalone.jar
8899
89100```
90- java -jar sqlscript2jpa-codegen-maven-plugin-1.0.5 -standalone.jar "<sql_file_path>" "<package_name>"
101+ java -jar sqlscript2jpa-codegen-maven-plugin-1.0.6 -standalone.jar "<sql_file_path>" "<package_name>"
91102```
92103
93104This will generate the JPA entities in a folder structure as defined by the package name
0 commit comments