💡DB model - Deprecated

Every database model must extend AbstractDbModel.

A class must have a field that is annotated by Id annotation

Define your table name in geTableName method.

The table name must be defined without a table prefix.

In every constructor must be called init method.

Example of the implementation of DbModel.

@Table(name = "users") //or override getTableName()
public class MyUser extends AbstractDbModel implements User {

    @Id
    private final UUID uuid;
    private double coins;
    
    public static final String TABLE_NAME = "users";

    public UserCoinsImpl(UUID uuid, double coins) {
        this.uuid = uuid;
        this.coins = coins;
        init();
    }
    
    //getters and setters
    
    //You can use @Table annotation insted of this
    @Override
    public String getTableName() {
        return TABLE_NAME;
    }
}

Last updated