Giter Club home page Giter Club logo

sassine / sqlschema2java Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 171 KB

sqlschema2java generates Java types from SQLSchema and annotate those types for data-binding with Jackson 2.x, Javax Persistence and Spring Repository.

Home Page: https://sassine.dev

License: MIT License

Shell 0.29% ANTLR 13.83% Java 85.87%
antlr4 java maven-plugin sql sql-schema class classloader dto dto-entity-mapper entity jackson java-library jpa-hibernate lombok maven reflection

sqlschema2java's Introduction

SQLSchema2Java Open Source Love svg1

Coverage Status CodeQL main

Maven Central Maven Central

Logo SQL2JAVA  and website adress sassine.dev/sqlschema2java

sqlschema2java generates Java types from SQLSchema and annotate those types for data-binding with Jackson 2.x, Javax Persistence and Spring Repository.

File SQL -> Funil -> Generate Files DTO, Entity and Repostiory.java

You can use sqlschema2java as a Maven plugin. Try at the sample project exemple

Read Getting Started

Implementation

A very simple Maven example:

pom.xml
 <plugins>
            <plugin>
                <groupId>dev.sassine.api</groupId>
                <artifactId>sqlschema2java-maven-plugin</artifactId>
                <version>1.0.0-beta</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sourceDirectory>./example.sql</sourceDirectory>
                    <packageName>dev.sassine.api</packageName>
                    <useAutoIncrement>true</useAutoIncrement>
                    <usePostgreSQL>false</usePostgreSQL>
                </configuration>
            </plugin>
</plugins>

Parameters

Name required type description
sourceDirectory true String SQL file path
packageName true String package name with points that will be generated
useAutoIncrement false Boolean disable or enable whether the primary key will have its value generated automatically
usePostgreSQL true Boolean disable or enable query conversion compatible with postgres database
Run command
mvn dev.sassine.api:sqlschema2java-maven-plugin:generate

Successful โœจ

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

ko-fi

License

GitHub license

sqlschema2java's People

Contributors

dependabot[bot] avatar sassine avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

sqlschema2java's Issues

Fix Query contains COMMENT and/or CHARACTER SET

Query example result error parsing

CREATE TABLE ExampleTutorial (
	id INT(20) NOT NULL AUTO_INCREMENT,
	title VARCHAR(255) NOT NULL,
	dat_calendar DATE(20),
	description TEXT(20) COMMENT 'Description post',
	content TEXT(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
	PRIMARY KEY (id)
);`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.