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.
- 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
@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;
}
Member member = Member.queryByPrimaryKey(11);
Member member = Member.queryFirst("id = ?", 11);
List<Member> members = Member.query("id > ?", 8);
List<Member> members = Member.queryAll();
int count = Member.count("id > ?", 10);
Member.destory(1);
Member.destory("id = ?", 1);
...
Member member = Member.queryPrimary(1, Member.HAS_MANY_ORDERS);
List<Order> orders = member.getOrders();
Member member = Member.queryByName("demo", Member.HAS_MANY_ORDERS);
List<Order> orders = member.getOrders();
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.5</version>
</dependency>
Installing IntelliJ Plugin: Preferences/Settings -> Plugins -> Search with "ObjectiveSql" in market -> Install