📚
Szczurowsky Industries
RatORM
RatORM
  • 🖐️Welcome!
  • ⚡Quick Start
  • 🎓Features
  • 🧑‍🎓Basic
    • Model
    • Operation
  • 🙉Annotations
    • Model
    • ModelField
Powered by GitBook
On this page
  • What is model?
  • Why should i use model instead of normal query's?
  • How i am supposed to create model?
  1. Basic

Model

What is model?

Model is representation of table (or collection) in database. It can be accesed as typical java object. Every CRUD operation can be done just with calling RatORM initalized method responsible for its role (like delete - .delete)

Why should i use model instead of normal query's?

ORM (Object Relation Mapping) is way more comfortable and secure then using query's. Everything you need to do is just modify object and call method. Simple as that

How i am supposed to create model?

Creating model is just creating new class with (only) fields using Annotationson every field and one on class.

Example

@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;
}
PreviousFeaturesNextOperation

Last updated 3 years ago

🧑‍🎓