This is a bit confusing so to go with an example
Query<Order> query = Ebean.createQuery(Order.class);query.join("details");query.orderBy("details.product.id");List<Order> orders = query.findList();
The problem here is that both the 'master' order is fetched along with the 'detail' order details - AND the order by includes a property from order details (details.product.id in this case).
In this case Ebean will automatically ensure the order by includes the order.id BEFORE a order by on any details property.
This is not quite right in 0.9.6... and Ebean will potentially give an error loading the beans.
Fixed.
The issue was with CQueryPredicates.deriveOrderByWithMany().