DEV Community

Braisdom
Braisdom

Posted on

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

Top comments (13)

Collapse
 
garveyzhong profile image
GarveyZhong

oh!今天剛加入dev 就讓我看到這麽好玩的框架,很是期待啊!

Collapse
 
braisdom profile image
Braisdom

同是中国人,感谢支持

Collapse
 
garveyzhong profile image
GarveyZhong

必須的,現在就打開idea折騰一下ObjectiveSQL

Thread Thread
 
braisdom profile image
Braisdom

有问题可以提 issues

Thread Thread
 
garveyzhong profile image
GarveyZhong

👌

Collapse
 
utsav160 profile image
utsav160

That annotation belong to Jparepostory?

Collapse
 
utsav160 profile image
utsav160

Okay sorry objectivesql is it orm first time heard about that is it same as hibernate or ibatis ?

Collapse
 
braisdom profile image
Braisdom

Yes, but its goal is to go beyond the existing ORM framework,

1) Dynamical code generation(querying, updating, etc)
2) Easy to relation query and paged query
3) Java operator can convert to SQL expression directly

Above are basic features, you can visit github.com/braisdom/ObjectiveSql

Collapse
 
braisdom profile image
Braisdom

Please share it to your friend if you like. Thanks.

Collapse
 
braisdom profile image
Braisdom

No, it's ObjectiveSQL's, but it's much more expressive

Collapse
 
utsav160 profile image
utsav160

Okay thanks for useful information going to implement soon

Thread Thread
 
braisdom profile image
Braisdom

You are welcome

Collapse
 
braisdom profile image
Braisdom

I hope more people will support me