DoytoQuery - The First Implementation of Object SQL Mapping for Java Applications Over Relational Databases
DoytoQuery is a powerful and easy-to-use Object SQL Mapping (OSM) framework for Java applications over relational databases. Unlike object-relational mapping (ORM), which attempts to directly map the object model and the relational model, OSM introduces SQL as an intermediary between the object model and the relational model and concludes a set of solutions to map objects to SQL statements.
- The Query Mapping Solution in DoytoQuery
- The Paging and Sorting Solution in DoytoQuery
- The Improved CRUD Solution in DoytoQuery
- The Related Query Solution in DoytoQuery
- The Conditional Related Query Solution in DoytoQuery
- The Aggregation Solution in DoytoQuery
- The Natural Joins Mapping Solution
- The Associative Table Solution in DoytoQuery
- The Sharding Solution in DoytoQuery
- 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.