Pre-requisite: [https://hibernate.atlassian.net/browse/HSEARCH-4574|https://hibernate.atlassian.net/browse/HSEARCH-4574|smart-link]
Useful in complicated schemas, to break cycles in particular.
E.g. the following schema wouldn’t work unless we support {{@ObjectProjection(includeDepth = ...)}}
{noformat}@ProjectionConstructor public record WishList( UUID id, String title, Boolean restricted, @ObjectProjection(includeDepth = 1) List<Product> products ) {} {noformat}
{noformat}@ProjectionConstructor public record Product( UUID id, String title, String keywords, String description, Integer rating, LocalDate dateAdded, LocalDate dateModified, @ObjectProjection(includeDepth = 1) WishList wishList ) { } {noformat}
{{includePaths}} would be similarly useful:
{noformat}@ProjectionConstructor public record Product( UUID id, String title, String keywords, String description, Integer rating, LocalDate dateAdded, LocalDate dateModified, @ObjectProjection(includePaths = {"title", "products.title"}) WishList wishList ) { } {noformat} |
|