|
1 |
| -# sqlschema2java |
| 1 | +# SQLSchema2Java [](https://github.com/Sassine/sqlschema2java/actions/workflows/deploy.yml) [](https://github.com/Sassine/sqlschema2java/actions/workflows/codeql-analysis.yml) |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | +_sqlschema2java_ generates Java types from SQLSchema and annotate those types for data-binding with Jackson 2.x, Javax Persistence and Spring Repository. |
| 7 | + |
| 8 | +You can use sqlschema2java as a Maven plugin. |
| 9 | +[**Try at the sample project exemple**](https://github.com/Sassine/sqlschema2java/tree/main/sqlschema2java-example) |
| 10 | + |
| 11 | +## Implementation |
| 12 | + |
| 13 | +#### A very simple Maven example: |
| 14 | +```xml |
| 15 | +pom.xml |
| 16 | + <plugins> |
| 17 | + <plugin> |
| 18 | + <groupId>dev.sassine.api</groupId> |
| 19 | + <artifactId>sqlschema2java-maven-plugin</artifactId> |
| 20 | + <version>1.0.0</version> |
| 21 | + <executions> |
| 22 | + <execution> |
| 23 | + <goals> |
| 24 | + <goal>sqlschema2java</goal> |
| 25 | + </goals> |
| 26 | + </execution> |
| 27 | + </executions> |
| 28 | + <configuration> |
| 29 | + <sourceDirectory>/user/home/example.sql</sourceDirectory> |
| 30 | + <packageName>dev.sassine.api</packageName> |
| 31 | + <useAutoIncrement>true</useAutoIncrement> |
| 32 | + <isPostgres>false</isPostgres> |
| 33 | + </configuration> |
| 34 | + </plugin> |
| 35 | +</plugins> |
| 36 | + |
| 37 | +<repositories> |
| 38 | + <repository> |
| 39 | + <id>github</id> |
| 40 | + <name>GitHub Packages SQLSchema2Java</name> |
| 41 | + <url>https://maven.pkg.github.com/Sassine/sqlschema2java</url> |
| 42 | + </repository> |
| 43 | +</repositories> |
| 44 | +``` |
| 45 | +### Parameters |
| 46 | +| Name | required | type | description | |
| 47 | +|--|--|--|--| |
| 48 | +| sourceDirectory | true | String | SQL file path | |
| 49 | +| packageName | true | String | package name with points that will be generated | |
| 50 | +| useAutoIncrement| false | Boolean| disable or enable whether the primary key will have its value generated automatically | |
| 51 | +| isPostgres| true | Boolean | disable or enable query conversion compatible with postgres database | |
| 52 | + |
| 53 | + |
| 54 | +##### Run command |
| 55 | +```bash |
| 56 | +mvn dev.sassine.api:sqlschema2java-maven-plugin:generate |
| 57 | +``` |
| 58 | +Successful ✨ |
| 59 | + |
| 60 | +## Contributing |
| 61 | +Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. |
| 62 | + |
| 63 | +Please make sure to update tests as appropriate. |
| 64 | + |
| 65 | +## License |
| 66 | + |
| 67 | +[MIT ](https://github.com/Sassine/sqlschema2java/blob/main/LICENSE) |
0 commit comments