DoytoQuery - The First Implementation of Object SQL Mapping for Java Applications Over Relational Databases
DoytoQuery is a powerful and easy-to-use Object/Query-Language Mapping (OQM) framework for Java applications over relational databases. Unlike object-relational mapping (ORM), which attempts to map the object model and the relational model directly, OQM introduces query languages as an intermediary between the object-oriented application systems and the database management system to map objects to query statements.
- Data Access Layer
- CRUD operations for single/sharding table.
- CRD operations for associative table.
- Query with related entities and views.
- Service Layer
- CRUD methods.
- Second-Level Cache.
- UserId Injection.
- EntityAspect Extensions.
- Controller Layer
- Support RESTFul API.
- ErrorCode Pre-definition.
- Exception Assertion.
- Exception Handler.
- JsonResponse Wrapper.
- Request/Entity/Response Transition.
- Group Validation.
- Seamless integration with Spring WebMvc.
- Supported Databases
- MySQL
- Oracle
- SQL Server
- PostgreSQL
- SQLite
- HSQLDB
- MongoDB
For a UserEntity
defined as follows:
@Getter
@Setter
@Entity(name = "user")
public class UserEntity extends AbstractPersistable<Long> {
private String username;
private String email;
private Boolean valid;
}
we can define a query object to query data from database as follows:
@Getter
@Setter
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class UserQuery extends PageQuery {
private String username;
private String emailLike;
private Boolean valid;
}
and invoke the DataAccess#query(Q)
method like this:
@Service
public class UserService extends AbstractCrudService<UserEntity, Long, UserQuery> {
public List<UserEntity> findValidGmailUsers() {
UserQuery userQuery = UserQuery.builder().emailLike("@gmail.com").valid(true).pageSize(10).build();
// Executed SQL: SELECT username, email, valid, id FROM t_user WHERE email LIKE ? AND valid = ? LIMIT 10 OFFSET 0
// Parameters : %@gmail.com%(java.lang.String), true(java.lang.Boolean)
return dataAccess.query(userQuery);
}
}
Please refer to the demo for more details.
Module | Snapshot | Release |
---|---|---|
doyto-query-api | ||
doyto-query-geo | ||
doyto-query-common | ||
doyto-query-memory | ||
doyto-query-sql | ||
doyto-query-jdbc | ||
doyto-query-web-common | ||
doyto-query-web | ||
doyto-query-dialect |
-
Frameworks
-
DevOps
-
Projects
-
Documentation
This project is under the Apache Licence v2.