JWS Object Relational Mapping

![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/JavaWebStack/orm/Maven%20Deploy/master) ![GitHub](https://img.shields.io/github/license/JavaWebStack/orm) ![Maven metadata URL](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo1.maven.org%2Fmaven2%2Forg%2Fjavawebstack%2Form%2Fmaven-metadata.xml) ![GitHub contributors](https://img.shields.io/github/contributors/JavaWebStack/orm) ![Lines of code](https://img.shields.io/tokei/lines/github/JavaWebStack/orm) ![Discord](https://img.shields.io/discord/815612319378833408?color=%237289DA&label=discord) ![Twitter Follow](https://img.shields.io/twitter/follow/JavaWebStack?style=social) ## Introduction When it came to using an ORM Lib in java I used ORMLite before. It worked quite well, but I didn't like the query builder. Another thing was that I wanted to have control over the JDBC Wrapper to have a simple way of implementing an auto-reconnect function, if it gets disconnected for some reason. I finally decided to make an own ORM that fits my needs and here it is. ## Documentation You can find the current docs on our [website](https://docs.javawebstack.org/framework/orm). This is a work-in-progress project though so it's not yet complete. ### Example usage #### Model ```java @Dates @SoftDelete class User extends Model { @Column int id; @Column String name; @Column Timestamp createdAt; @Column Timestamp updatedAt; @Column Timestamp deletedAt; } ``` #### Usage ```java //Create connection, initialize repos SQL sql = new MySQL("localhost",3306,"mydb","myuser","changeme1234"); ORMConfig config = new ORMConfig().setDefaultSize(255); //optional Repo repo = ORM.register(User.class, sql, config); //Create the table if it doesn't exist (optional) repo.migrate(); //Print all usernames for(User user : Repo.get(User.class).all()){ System.out.println(user.name); } ``` ## Maven ### Dependency ```xml org.javawebstack orm 1.0.3 ``` ### Driver You also need to add the driver you want to use. JavaWebStack ORM comes with a wrapper for com.mysql.jdbc.Driver, but you can also create an own wrapper implementing the interface SQL. ```xml mysql mysql-connector-java 8.0.30 compile ```