1
1
# sqlscript2jpa-codegen
2
2
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
4
4
jar to be run as a standalone tool. It internally uses JSqlParser to parse the DDL statements.
5
5
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
+
6
14
### Getting Started
7
15
8
16
## Prerequisites
@@ -14,6 +22,9 @@ jar to be run as a standalone tool. It internally uses JSqlParser to parse the D
14
22
* CREATE TABLE
15
23
* ALTER TABLE ADD CONSTRAINT PRIMARY KEY
16
24
* 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** .
17
28
18
29
## Maven
19
30
@@ -84,10 +95,10 @@ By default, the source code will be generated under `target/generated-sources/sq
84
95
## Standalone
85
96
86
97
Get 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
88
99
89
100
```
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>"
91
102
```
92
103
93
104
This will generate the JPA entities in a folder structure as defined by the package name
0 commit comments