12

I have issues trying to access nested object when using BooleanBuilder. I have read that the default is 2 levels, but for my use case, I need to access 3rd level nested objects. So I have added @QueryInit as pointed out in many other answers. But I still cannot access it. Here is my code:

@Document
public class Order implements Serializable {

     @QueryInit(*.*)
     private Item item;

}

public class Item implements Serializable {
   private Details details;
}

public class Details implements Serializable {
   private String name;
}

public static BooleanExpression name(String name) {
  QOrder order = QOrder.order;
  return order.item.details.name.eq(name)
}

I have QOrder, QItem classes generated and working fine. But details.description gives error because QDetails class was not generated. How do I make it generate QDetails?

Naveen Kulkarni
  • 233
  • 2
  • 17
user1955934
  • 3,185
  • 5
  • 42
  • 68

1 Answers1

0

The first problem I see is that you missed a semicolon on the return statement which might be causing you some other issues. The way to generate QDetails is to first reference the query, and request the details from the assigned result.

Vendetta
  • 2,078
  • 3
  • 13
  • 31