π Release v2.0.0
π Release Date: February 18, 2025
π This major release introduces powerful enhancements for dynamic querying in Spring Data JPA while simplifying the API.
β¨ New Features
-
Projection Interface Support
- You can now map query results directly to DTOs or interfaces without additional conversions.
- Example:
β Cleaner & more efficient than manual DTO conversion, and more powerful then Spring's original projection mechanism.
@RestController @RequestMapping("/users") public class UserController { @Autowired private ProjectionFactory projectionFactory; @Autowired private UserRepository userRepository; @PostMapping("/search") public List<UserMinimalDto> getAllMinimal() { return projectionFactory.create(User.class, UserMinimalDto.class).findAll(); } }
-
Refactored Query API π
- Removed
executeQuery
method as it can be found confusing. - Added
Query<T> get(Specification<T> specification);
which supports building on existingSpecification
objects.
- Removed
π₯ Breaking Changes
- Removed executeQuery Method
- The
executeQuery
method has been removed in favor ofProjection
interface which contains all the necessary methods to replace theexecuteQuery
method.
- The
β‘ Upgrade Guide
- Maven Dependency Update
- Update your pom.xml to use the latest version:
<dependency>
<groupId>dev.rosemarylab.dataquerying</groupId>
<artifactId>DataQuerying</artifactId>
<version>2.0.0</version>
</dependency>
- Replace
executeQuery
calls
- Switch to Projections for specifying the entity type, return type, and optionally filter data with or without pagination.
Query<User> query = Query.where("name", "John");
return projectionFactory.create(User.class, UserMinimalDto.class).findAll(query.buildSpecification());
π’ Feedback & Contributions
We'd love to hear your feedback! Feel free to open an issue or submit a PR.
π Happy Querying!
π₯ DataQuerying v2.0.0