How do I reference children in a Java Xpath retrieve?

I’m a total beginner in Java and all of my past Java work is primarily done by reading carefully, trying to understand and get inspired to re-use similarly. So bear with me. To simplify context, let’s say we have Customers that have Orders and I want to retrieve all customers of which the most recent order was at least 6 months ago, or have no orders at all. Or better phrased: Retrieve all customers that have no order that was created in the past 6 months. How would I write that Xpath retrieve in Java? Due to unrelated reasons (in short: Dynamic XPaths), the retrieve has to be done in Java, extending the Java file we already use. I couldn’t find a reference in our java files using a 1-* reference, causing no inspiration for me to copy. Normally, for a 1-1 association, I could write something like this. XPath < Customer > xpath = XPath.create(context, Customer.class); xpath.subconstraint(Customer.MemberNames.Customer_Address, Address.entityName) .eq(Address.MemberNames.PostalCode, '1234AB') .close(); But since a customer can have multiple orders, it seems I cannot reach Orders from Customer. How do I reach Orders? In addition, I’m trying to get something similar as the Mendix Xpath Not function. Is that simply .not()?
1 answers

Hi Sander, 

as the Order is the owner of the association, you have to start from there and get your customers. 
The xpath should then look something like this :

XPath<Customer> xpath = XPath.create(getContext(), Customer.class)
      .subconstraint(Order.MemberNames.Order_Customer, Order.entityName)...

Could not come up with a working example though.