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

GitHUB SOURCE : https://github.com/braisdom/ObjectiveSql/

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

1 Features

  • Dynamic code generation with JSR 269 for Java API of database access
  • Full Java API of database access without coding
  • Object-oriented SQL programming for complex SQL in Java

2 Solutions for simple SQL programming

2.1 Defining domain models only

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

2.2 Query&Update methods

Member.countAll();
Member.count("id > ?", 10);
Member.queryByPrimaryKey(11);
Member.queryFirst("id = ?", 11);
Member.query("id > ?", 8);
Member.queryAll();
...

2.3 The relation query

Member.queryAll(Member.HAS_MANY_ORDERS);
Member.queryPrimary(1, Member.HAS_MANY_ORDERS);
Member.queryByName("demo", Member.HAS_MANY_ORDERS);
...

3 Solutions for complex SQL programming

Order.Table orderTable = Order.asTable();
Select select = new Select();

select.project(sum(orderTable.amount) / sum(orderTable.quantity) * $(100) )
    .from(orderTable)
    .groupBy(orderTable.productId);

Generated SQL below:

SELECT SUM(order.amount) / SUM(order.quantity)  * 100
      FROM orders AS order GROUP BY order.produc_id

4 Guides/中文

If you are using Maven just add the following dependency to your pom.xml:

<dependency>
    <groupId>com.github.braisdom</groupId>
    <artifactId>objective-sql</artifactId>
    <version>1.3.7</version>
</dependency>

Installing IntelliJ Plugin: Preferences/Settings -> Plugins -> Search with “ObjectiveSql” in market -> Install

Unauthorized reproduction of this site is prohibited, and offenders will be held accountable for their legal responsibilities.
Article Title: ObjectiveSQL is an ORM framework in Java base on ActiveRecord pattern, which encourages rapid development and clean, codes with the least and convention over configuration.
This article URL:ObjectiveSQL is an ORM framework in Java base on ActiveRecord pattern, which encourages rapid development and clean, codes with the least and convention over configuration.

All Categories

Github Trending Repositories

Explore Github Trending Repositories. See what the GitHub community is most excited about today.

Copyright 2010 - 2020