🐀 Simple, Fast and easy to implement ORM for most popular databases

Overview

RatORM

Simple, Fast and easy to implement ORM for most popular databases

Build with java It works why?

Status:

Branch Tests Code Quality
master CircleCI CodeFactor Grade

Usefull links

Helpful links:

List of databases

  • MongoDB
  • MySQL (Soon)
  • MariaDB (Soon)
  • PostgreSQL (Soon)
  • SQLite (Soon)

MineCodes Repository (Maven or Gradle) ️

<repository>
  <id>minecodes-repository</id>
  <url>https://repository.minecodes.pl/releases</url>
</repository>
maven { url "https://repository.minecodes.pl/releases" }

Dependencies (Maven or Gradle)

Framework Core

<dependency>
    <groupId>pl.szczurowsky</groupId>
    <artifactId>rat-orm-core</artifactId>
    <version>1.4.0</version>
</dependency>
implementation 'pl.szczurowsky:rat-orm-core:1.4.0'

Database

<dependency>
    <groupId>pl.szczurowsky</groupId>
    <artifactId>rat-orm-type</artifactId>
    <version>1.4.0</version>
</dependency>
implementation 'pl.szczurowsky:rat-orm-type:1.4.0'

Usage

More advance examples in docs

Connect

By credentials
public class Example {
    
    Database database;
    
    public void connect() {
        // Replace MongoDB() with your database type
        this.database = new MongoDB();
        Map<String, String> credentials = new HashMap<>();
        credentials.put("name", "name of db");
        credentials.put("username", "username");
        credentials.put("password", "password");
        credentials.put("host", "DNS or IP");
        credentials.put("port", "port");
        this.database.connect(credentials);
    }
    
}
By URI
public class Example {
    
    Database database;
    
    public void connect() {
        // Replace MongoDB() with your database type
        this.database = new MongoDB();
        this.database.connect("URI String");
    }
    
}

Create model

Model class
@Model(tableName="example-table")
public class ExampleModel extends BaseModel {
    @ModelField(isPrimaryKey = true)
    int id;
    @ModelField
    String username = "default value";
    // Custom table name
    @ModelField(name="test")
    String oneName;
}
Initialization of model
public class Example {
    
    Database database;
    
    public void connect() {
        // Replace MongoDB() with your database type
        this.database = new MongoDB();
        this.database.connect("URI String");
        this.database.initModel(Arrays.asList(
                ExampleModel.class
        ));
    }
    
}

Read model(s)

Every model
public class Example {
    
    Database database;
    
    public void connect() {
        // Replace MongoDB() with your database type
        this.database = new MongoDB();
        this.database.connect("URI String");
        this.database.initModel(Arrays.asList(
                ExampleModel.class
        ));
        this.database.fetchAll(ExampleModel.class);
    }
    
}
Exact model(s)
public class Example {
    
    Database database;
    
    public void connect() {
        // Replace MongoDB() with your database type
        this.database = new MongoDB();
        this.database.connect("URI String");
        this.database.initModel(Arrays.asList(
                ExampleModel.class
        ));
        this.database.fetchMatching(ExampleModel.class, "Key", "Value");
    }
    
}

Save model

Save one
public class Example {
    
    Database database;
    
    public void connect() {
        // Replace MongoDB() with your database type
        this.database = new MongoDB();
        this.database.connect("URI String");
        this.database.initModel(Arrays.asList(
                ExampleModel.class
        ));
        ExampleModel exampleModel = new ExampleModel();
        this.database.save(exampleModel, ExampleModel.class);
    }
    
}
Comments
  • Bump json from 20211205 to 20220320

    Bump json from 20211205 to 20220320

    Bumps json from 20211205 to 20220320.

    Release notes

    Sourced from json's releases.

    20220320

    Pull Request Description
    #660 Wrap StackOverflow with JSONException
    Changelog

    Sourced from json's changelog.

    20220320 Wrap StackOverflow with JSONException

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Bump maven-surefire-plugin from 2.22.0 to 2.22.2

    Bump maven-surefire-plugin from 2.22.0 to 2.22.2

    Bumps maven-surefire-plugin from 2.22.0 to 2.22.2.

    Commits
    • d96b95c [maven-release-plugin] prepare release surefire-2.22.2
    • 4a2aafc Remove Travis file
    • 7b9ec3f Remove JUnit SNAPSHOT argument from IT
    • 18b4078 [SUREFIRE-1614] JUnit Runner that writes to System.out corrupts Surefire's ST...
    • af417b8 prepare for next development iteration
    • c23c8b9 [maven-release-plugin] prepare release surefire-2.22.1_vote-1
    • 5376261 [SUREFIRE-1564] Can't override platform version through project/plugin depend...
    • 242c0e8 [SUREFIRE-1564] Can't override platform version through project/plugin depend...
    • 25fadfc CheckTestNgSuiteXmlIT should not be ignored
    • 57fbb16 [SUREFIRE-1532] MIME type for javascript is now officially application/javasc...
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Bump mongo-java-driver from 3.12.10 to 3.12.11

    Bump mongo-java-driver from 3.12.10 to 3.12.11

    Bumps mongo-java-driver from 3.12.10 to 3.12.11.

    Release notes

    Sourced from mongo-java-driver's releases.

    Java Driver 3.12.11 (April 22, 2022)

    Release notes: https://www.mongodb.com/community/forums/t/mongodb-java-driver-3-12-11-released/159538

    Commits
    • adfd822 Bump to 3.12.11
    • 7360e36 Skip legacy explain tests on server > 5.0
    • 412c62d Skip hint test on servers > 5.0
    • 72a399f Skip tests of multiple credentials on servers > 5.0
    • d7acfc6 Fix: ServerDescriptionTest.testDefaults
    • b8c6654 Skip $explain modifier test on servers > 4.4
    • 95a2386 Relax assertion on invalid amazon region for CSFLE tests
    • 28264f4 Fix assertions in CSFLE tests
    • aa5824a ByteBuffer is not released when compression is enabled, causing pool leakage ...
    • 8624506 Bump maximum supported wire version to 15
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Release version 1.3

    Release version 1.3

    FIX

    • Bug with internal cache
    • Error when trying to serialize empty map Add:
    • Locking thread of object when saving/deleting
    • Add collection serializer
    • Add optional cache
    opened by Szczurowsky 0
  • Add foreign key support.

    Add foreign key support.

    Example:

    @Model(tableName="users")
    public class User {
    
        @ModelField(isPrimaryKey = true)
        int id;
        
        @ModelField
        String name = "Rollczi";
    
    }
    
    @Model(tableName="teams")
    public class Team {
        @ModelField(isPrimaryKey = true)
        int id;
        @ModelField
        String teamName = "none";
        // Custom table name
        @ForeignKey
        User owner;
    }
    

    Result:

    Teams

    idteamNameowner_id
    0ROLL0

    Users

    idname
    0Rollczi
    enhancement 
    opened by Rollczi 0
  • Bump junit-jupiter from 5.8.2 to 5.9.0

    Bump junit-jupiter from 5.8.2 to 5.9.0

    Bumps junit-jupiter from 5.8.2 to 5.9.0.

    Release notes

    Sourced from junit-jupiter's releases.

    JUnit 5.9.0 = Platform 1.9.0 + Jupiter 5.9.0 + Vintage 5.9.0

    See Release Notes.

    JUnit 5.9.0-RC1 = Platform 1.9.0-RC1 + Jupiter 5.9.0-RC1 + Vintage 5.9.0-RC1

    See Release Notes.

    JUnit 5.9.0-M1 = Platform 1.9.0-M1 + Jupiter 5.9.0-M1 + Vintage 5.9.0-M1

    See Release Notes.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Change error text

    Change error text

    https://github.com/Szczurowsky/RatORM/blob/6ef8286f4273451044b580b8515acf9dcd3595bf/rat-orm-mongodb/src/main/java/pl/szczurowsky/ratorm/mongodb/MongoDB.java#L353

    opened by Szczurowsky 0
  • Release RatORM 2.0

    Release RatORM 2.0

    Rewrite:

    • [x] Serializers
    • [x] Core
    • [x] Improved operations
    • [x] Annotations
    • [ ] Foreign keys
    • [ ] Improve error printing
    • [ ] Add full support for lists
    • [ ] Add HikariCP support
    • [ ] Create mathcing fields for basic datatypes
    • [ ] Add builder for RatORM instance New:
    • [x] New credentials system
    opened by Szczurowsky 0
Releases(1.4.0)
  • 1.4.0(Apr 15, 2022)

    Changelog:

    • Added support for enums serialization
    • Added foreign key support
    • Added operations along with transactions
    • Rewrited core extendable class
    Source code(tar.gz)
    Source code(zip)
Owner
Szczurowsky
Hello there
Szczurowsky
A simple Plugin to allow server admins and user with Permissions to change fast and easy thier own Gamemode

A simple Plugin to allow server admins and user with Permissions to change fast and easy thier own Gamemode

Qubik Studios 1 Jan 17, 2022
This project was created as a simple example to show how we can implement the hexagonal architecture(software design) proposed by Netflix.

Netflix Hexagonal Architecture Table of contents About the project Description Built with Installation Requirements to run Usage information Run Licen

José Lucas 12 Dec 20, 2022
A simple quarkus app with hibernate as ORM, used to show the features of Hibernate Search

beer-manager-hibernate-search Project This project uses Quarkus, the Supersonic Subatomic Java Framework. If you want to learn more about Quarkus, ple

Sedona Solutions 3 Jan 6, 2022
A distributed lock that supports the use of Redis and Zookeeper, out of the box, fast and easy to use

lock-spring-boot-starter A distributed lock that supports the use of Redis and Zookeeper, out of the box, fast and easy to use 一款基于 Redis 和 Zookeeper

Pear Stack 9 Oct 15, 2022
Android Auto Apps Downloader (AAAD) is an app for Android Phones that downloads popular Android Auto 3rd party apps and installs them in the correct way to have them in Android Auto.

Android Auto Apps Downloader (AAAD) is an app for Android Phones that downloads popular Android Auto 3rd party apps and installs them in the correct way to have them in Android Auto.

Gabriele Rizzo 865 Jan 2, 2023
Multi-Tenant Spring Boot Application with separate databases using Hibernate and H2.

Multi-Tenant Spring Boot Application A Spring Boot application that utilises a multi-tenancy architecture by providing multiple databases, one for eac

Alex Gschnitzer 15 May 9, 2022
Build criterion and ecosystem above multi-model databases

ShardingSphere - Building a Criterion and Ecosystem Above Multi-Model Databases Official Website: https://shardingsphere.apache.org/ Stargazers Over T

The Apache Software Foundation 17.8k Jan 9, 2023
A cross-platform Mod for the popular Minecraft project, where the border always has a radius equal to the player's current experience level.

Level = Border A cross-platform Mod for the popular Minecraft project, where the border always has a radius equal to the player's current experience l

Jakob K 14 Nov 22, 2022
Desktop browser based game using the popular Pokemon franchise.

Project Title: Pokemon Auto-Battler Description: Desktop browser based game using the popular Pokemon franchise. Why? Its a topic we are interested in

null 2 Feb 3, 2022
In this project, we will implement two Spring Boot Java Web application called, streamer-data-jpa and streamer-data-r2dbc.

In this project, we will implement two Spring Boot Java Web application called, streamer-data-jpa and streamer-data-r2dbc. They both will fetch 1 million of customer's data from MySQL and stream them to Kafka. The main goal is to compare the application's performance and resource utilization.

Ivan Franchin 6 Nov 2, 2022
Fast Android Development. Easy maintainance.

Fast Android Development. Easy maintenance. AndroidAnnotations is an Open Source framework that speeds up Android development. It takes care of the pl

null 11.1k Dec 31, 2022
Tuya 37 Dec 26, 2022
How To Implement Fault Tolerance In Microservices Using Resilience4j

springboot-resilience4j-demo How To Implement Fault Tolerance In Microservices Using Resilience4j? Things todo list: Clone this repository: git clone

Hendi Santika 4 Mar 30, 2022
The utility is designed to implement version control of APEX application pages.

Oracle APEX version control tool The utility is designed to implement version control of APEX application pages. How it works The developer exports th

Oleksii Vykhristiyk 6 Aug 25, 2022
This sample shows how to implement two-way text chat over Bluetooth between two Android devices, using all the fundamental Bluetooth API capabilities.

Zenitsu-Bluetooth Chat Application This sample shows how to implement two-way text chat over Bluetooth between two Android devices, using all the fund

Gururaj Koni 1 Jan 16, 2022
With react-native-update-in-app library you can easily implement in-app updates in your React Native app using CDN or any other file server

React Native In-App update With react-native-update-in-app library you can easily implement in-app updates in your React Native app using CDN or any o

Nepein Andrey 7 Dec 21, 2022
This module explains about the example of Spring MVC + Database Integration with MySQL using Hibernate ORM with practical coding example and required JAR dependencies

SpringMVC-Database-Integration This module explains about the example of Spring MVC + Database Integration with MySQL using Hibernate ORM with practic

GowthamRaj K 3 Nov 2, 2021
A code sharing platform built using spring boot, hibernate and JPA as ORM with PostgreSQL which also follows a RESTful architecture.

Snap-Snippet A code sharing platform built using spring boot, hibernate and JPA as ORM with PostgreSQL which also follows a RESTful architecture. Tech

Adnan Hossain 7 Nov 29, 2022
Mars - Object Relational Mapping Framework for MongoDB (MongoDB ORM)

Mars Object Relational Mapping Framework for MongoDB 致自己 造自己的轮子,让别人去说 ; What is Mars Mars is a unified driver platform product developed by Shanghai J

null 35 Nov 17, 2022