Hi.
I'm still not 100% sure I understood everything with groups....
I'd need a clearer high level view of the rationale for it, and some
use cases.
For the case I mentioned earlier, I think that just an improved
projection would do it.
This would, of course, require the order to be consistent with groups.
Here's an sketch of what could be done (kind of requires DTO
projection):
//DTOs
class User {
Long id;
String name;
List<Blog> blogs;
}
class Blog {
Long id;
User user;
String name;
List<Post> posts;
}
class Post {
Long id;
Blog blog;
Date date;
String user;
String comments;
}
QUser u = ...;
QBlog b = ...;
QPost p = ...;
Group<User> usersGroup = Group
.create(User.class)
.projecting(
u.id,
u.name)
.by(
u.name);
Group<Blog> blogsGroup = usersGroup.subGroup(SubGroup
.create("blogs", Blog.class) // "blogs" is the property in User
which holds the collection
.owner("user") //Optional: property in blog which holds the
reference to User
.projecting(
b.id,
b.name)
.by(
b.name));
blogsGroup.details(Details
.create("posts", Post.class)
.owner("blog")
.projecting(
p.id, p.date, p.user, p.comments));
CloseableIterator<User> users = query....
.orderBy(
u.name,
b.name)
.iterate(usersGroup);
Perhaps this is not exactly what is meant with ResultTransformer.
It seems like a valid (and common - faced it several times already)
use case, but maybe, it's complementary, not conflicting with
ResultTransformer...