Skip to content

Commit fe68df8

Browse files
committed
Update readme
1 parent 0fa1cc6 commit fe68df8

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

README.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,44 @@
11
# sqlscript2jpa-codegen
22

3-
DDL to JPA Code Generator Maven Plugin
3+
A Java library to generate JPA entities from DDL statements. The library offers both a maven plugin and a jar to be run as a standalone tool.
4+
5+
### Getting Started
6+
7+
## Maven
8+
9+
**sqlscript2jpa-codegen** is available at [Maven Central Repository](https://central.sonatype.com/artifact/io.github.ngbsn/sqlscript2jpa-codegen-maven-plugin).
10+
To use it, simply declare the following plugin in your pom file:
11+
12+
```xml
13+
<plugin>
14+
<groupId>io.github.ngbsn</groupId>
15+
<artifactId>sqlscript2jpa-codegen-maven-plugin</artifactId>
16+
<version>${latest-version-from-maven-central}</version>
17+
<executions>
18+
<execution>
19+
<id>parse-schema</id>
20+
<phase>compile</phase>
21+
<goals>
22+
<goal>parse-schema</goal>
23+
</goals>
24+
<configuration>
25+
<sqlFilePath>${basedir}/src/main/resources/sql/organization.sql</sqlFilePath>
26+
<packageName>org.mycompany.entities</packageName>
27+
</configuration>
28+
</execution>
29+
</executions>
30+
</plugin>
31+
```
32+
**sqlFilePath**: Path to the SQL file containing the DDL commands.
33+
**packageName**: The package name for the generated entities.
34+
35+
By default, the source code will be generated under `target/generated-sources/sqlscript2jpa`
36+
37+
## Standalone
38+
39+
Get the jar from https://repo1.maven.org/maven2/io/github/ngbsn/sqlscript2jpa-codegen-maven-plugin/1.0.3/sqlscript2jpa-codegen-maven-plugin-1.0.3-standalone.jar
40+
41+
```
42+
java -jar sqlscript2jpa-codegen-maven-plugin-1.0.3-standalone.jar "<sql_file_path>" "<package_name>"
43+
```
44+
This will generate the JPA entities in a folder structure as defined by the package name

0 commit comments

Comments
 (0)