β‘Quick Start
Setup Build Tools (Maven or Gradle)
<repositories>
<repository>
<id>minecodes-repository</id>
<url>https://repository.minecodes.pl/releases</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>pl.szczurowsky</groupId>
<artifactId>rat-orm-mongodb</artifactId>
<version>1.4.0</version>
<scope>compile</scope>
</dependency>
</dependencies>dependencies {
api 'pl.szczurowsky:rat-orm-core:1.4.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://repository.minecodes.pl/releases" }
}Connect to data source
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);
}
}Create model
Now to initialize model
CRUD
Create
Now we want to create object basing on our model
Read
Update
Delete
Last updated