All Projects → braisdom → Objectivesql

braisdom / Objectivesql

Licence: apache-2.0
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.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Objectivesql

Openrecord
Make ORMs great again!
Stars: ✭ 474 (-57.26%)
Mutual labels:  sql, orm, activerecord
Baby squeel
🐷 An expressive query DSL for Active Record 4 and 5
Stars: ✭ 362 (-67.36%)
Mutual labels:  sql, orm, activerecord
Github Ds
A collection of Ruby libraries for working with SQL on top of ActiveRecord's connection
Stars: ✭ 597 (-46.17%)
Mutual labels:  sql, activerecord
Lucid
AdonisJS official SQL ORM. Supports PostgreSQL, MySQL, MSSQL, Redshift, SQLite and many more
Stars: ✭ 613 (-44.72%)
Mutual labels:  sql, orm
Nano Sql
Universal database layer for the client, server & mobile devices. It's like Lego for databases.
Stars: ✭ 717 (-35.35%)
Mutual labels:  sql, orm
Ransack
Object-based searching.
Stars: ✭ 5,020 (+352.66%)
Mutual labels:  sql, activerecord
Go Sqlbuilder
A flexible and powerful SQL string builder library plus a zero-config ORM.
Stars: ✭ 539 (-51.4%)
Mutual labels:  sql, orm
Sequelize
An easy-to-use and promise-based multi SQL dialects ORM tool for Node.js
Stars: ✭ 25,422 (+2192.34%)
Mutual labels:  sql, orm
Pg
Golang ORM with focus on PostgreSQL features and performance
Stars: ✭ 4,918 (+343.46%)
Mutual labels:  sql, orm
Ktorm
A lightweight ORM framework for Kotlin with strong-typed SQL DSL and sequence APIs.
Stars: ✭ 843 (-23.99%)
Mutual labels:  sql, orm
Records
SQL for Humans™
Stars: ✭ 6,761 (+509.65%)
Mutual labels:  sql, orm
Express Knex Objection
A simple API system on a pg database, using knex and objection to simplify connection and management
Stars: ✭ 20 (-98.2%)
Mutual labels:  sql, orm
Topaz
A simple and useful db wrapper for Crystal-lang
Stars: ✭ 56 (-94.95%)
Mutual labels:  orm, activerecord
Qb
The database toolkit for go
Stars: ✭ 524 (-52.75%)
Mutual labels:  sql, orm
Exposed
Kotlin SQL Framework
Stars: ✭ 5,753 (+418.76%)
Mutual labels:  sql, orm
Sagacity Sqltoy
基于java语言比mybatis更实用的orm框架,支持mysql、oracle、postgresql、sqlserver、db2、dm、mongodb、elasticsearch、tidb、guassdb、kingbase、oceanbase、greenplum
Stars: ✭ 496 (-55.28%)
Mutual labels:  sql, orm
Godb
A Go SQL query builder and struct mapper.
Stars: ✭ 651 (-41.3%)
Mutual labels:  sql, orm
Jooq
jOOQ is the best way to write SQL in Java
Stars: ✭ 4,695 (+323.35%)
Mutual labels:  sql, orm
Fluent
Vapor ORM (queries, models, and relations) for NoSQL and SQL databases
Stars: ✭ 1,071 (-3.43%)
Mutual labels:  sql, orm
Smartsql
SmartSql = MyBatis in C# + .NET Core+ Cache(Memory | Redis) + R/W Splitting + PropertyChangedTrack +Dynamic Repository + InvokeSync + Diagnostics
Stars: ✭ 775 (-30.12%)
Mutual labels:  sql, orm

I'm very sorry about the lack of concern about this library Recently. So busy in doing other things and I have no time to maintain it. I will be back in 2 about months. Thanks everyone!(20200120)

近期其他事过于繁忙,以致没时间维护这个库了。很抱歉,不能更新和回答大家的问题。我会在大约两个月后回来继续更新维护它。谢谢大家的支持!同时本人待业中,有合适的工作可以联系我,微信:braisdom

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.

Features

  • With one annotation your Class has fully featured capabilities of SQL programming
  • Easy to relational(has_one, has_many and belongs_to) query and paged query
  • Writing SQL expressions(arithmetic, comparison and logical) using Java syntax

Why to choose

  • If your project focuses on data analysis based on relation database, and a lot of arithmetic expressions in SQL statement. ObjectiveSQL will help you write expressions conveniently and safely using Java syntax
  • If you don’t want to write Java codes of database access and various configuration files, ObjectiveSQL's dynamic code generation will help you access the database without coding

Performance(Oracle JMH)

query_perf

Installation

IntelliJ IDEA plugin installation

Preferences/Settings -> Plugins -> Search with "ObjectiveSql" in market -> Install

Maven dependencies
<!-- In standalone -->
<dependency>
    <groupId>com.github.braisdom</groupId>
    <artifactId>objective-sql</artifactId>
    <version>1.4.6</version>
</dependency>
<!-- In Spring Boot -->
<dependency>
  <groupId>com.github.braisdom</groupId>
  <artifactId>objsql-springboot</artifactId>
  <version>1.3.4</version>
</dependency>

Refer to the pom.xml for more configuration

Examples

ObjectiveSQL provides full example for various databases below, You can open it directly with IntelliJ IDEA as a standalone project. In fact, they are not just examples, but also unit tests of ObjectiveSQL in various databases.

If you want to run without configuration, you can try: SQLite

Others: MySQL, Oracle, MS SQL Server, PostgreSQL, Spring Boot

Simple SQL programming without coding

You define just a JavaBean with one annotation

@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;
}
Persistence
Member.create(newMember);
Member.create(new Member[]{newMember1, newMember2, newMember3}, false);

Member.update(1L, newMember, true);
Member.update("name = 'Smith => Jackson'", "name = ?", "Alice");

Member.destroy(1L);
Member.destroy("name = ?", "Mary");
Counting and querying
Member.countAll();
Member.count("id > ?", 1);
Member.queryByPrimaryKey(1);
Member.queryFirst("id = ?", 1);
Member.query("id > ?", 1);
Member.queryAll();
Paged querying
Page page = Page.create(0, 10);
PagedList<Member> members = Member.pagedQueryAll(page, Member.HAS_MANY_ORDERS);
Relation querying
Member.queryAll(Member.HAS_MANY_ORDERS);
Member.queryByPrimary(1, Member.HAS_MANY_ORDERS);
Member.queryByName("demo", Member.HAS_MANY_ORDERS);
...

Complex SQL programming

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

// In ObjectiveSQL, Java operator can be overloaded
select.project(sum(orderTable.amount) / sum(orderTable.quantity) * 100)
        .from(orderTable)
        .where(orderTable.quantity > 30 &&
            orderTable.salesAt.between("2020-10-10 00:00:00", "2020-10-30 23:59:59"))
        .groupBy(orderTable.productId);
SELECT SUM(`T0`.`amount`) / SUM(`T0`.`quantity`) * 100
FROM `orders` AS `T0`
WHERE `T0`.`quantity` > 30 AND 
       `T0`.`sales_at` BETWEEN '2020-10-10 00:00:00' AND '2020-10-30 23:59:59')
GROUP BY `T0`.`product_id`

Reference documentation

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].