Lombok can be as ORM framework

braisdom

Braisdom

Posted on December 5, 2020

Lombok can be as ORM framework

Do you like Lombok? Ohh! You might think it changed the way Java programming, but it makes your programming efficient.

Now, It can become an ORM framework, Improve your efficiency in SQL programming.

ObjectiveSQL is an ORM framework in Java based on ActiveRecord pattern, which encourages rapid development and clean, codes with the least, and convention over configuration.

Github

https://github.com/braisdom/ObjectiveSql

Features

  • With one annotation your Class has fully featured capabilities of SQL programming
  • Easy to relational(has_one, has_many, beglongs_to) querying and paged querying
  • Java expressions(arithmetic, comparison and logical) can be converted into SQL expression directly

Simple SQL programming without coding

You just define a JavaBean with one annotation your Class has fully capabilities of featured database access

@DomainModel
public class Member {
    private String no;

    @Queryable
    private String name;
    private Integer gender;
    private String mobile;
    private String otherInfo;

    @Relation(relationType = RelationType.HAS_MANY)
    private List<Order> orders;
}
Enter fullscreen mode Exit fullscreen mode

Querying

Member.countAll();
Member.count("id > ?", 1);
Member.queryByPrimaryKey(1);
Member.queryFirst("id = ?", 1);
Member.query("id > ?", 1);
Member.queryAll();
Enter fullscreen mode Exit fullscreen mode

Relation querying

Member.queryAll(Member.HAS_MANY_ORDERS);
Member.queryByPrimary(1, Member.HAS_MANY_ORDERS);
Member.queryByName("demo", Member.HAS_MANY_ORDERS);
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
braisdom
Braisdom

Posted on December 5, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related