According to the Blaze Persistence Document, a query could have multiple root entities. However, I could not find the way to do it. How do I implement multiple root entities on a Blaze Persistence query?
Add
Solved problem:
I implemented the following working test code thanks to Cristian.
@Test
void testThownExceptionWhenUsingRelativePathWithMultipleQueryRoots() {
// @formatter:off
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> {
CriteriaBuilder<String> cb = cbf.create(em, String.class)
.from(Cat.class, "c")
.from(Person.class, "p")
.select("name");
List<String> cats = cb.getResultList();
});
// @formatter:on
}
You just need to call .from(..)
multiple times.