I have an entity called ServiceList that has set of productListOrders
@Entity
@Table(name="service_lists")
public class ServiceList implements Serializable {
private static final long serialVersionUID = 1L;
private Set<ProductServiceListOrder> productServiceListOrders = new HashSet<ProductServiceListOrder>();
}
ProductServiceListOrder looks like this
public class ProductServiceListOrder implements Serializable {
private static final long serialVersionUID = 1L;
private ServiceList serviceList;
private Product product;
private Date createdAt;
private Long id;
private Integer internalOrder;
}
The trick is in internalOrder which the highest internalOder value showed first .. when I do my hibernate query I do like this ...
{
List<ServiceList> lists = (List<ServiceList>) JPA.em().createQuery(
"select distinct list from com.vionlabs.movieoncloud.model.main.ServiceList list " +
"left join fetch list.productServiceListOrders " )
}
MY QUESTION IS :- I want to set a limit on left join that means I want to get only the highest 10 productSeriveListOrders when I do the query ... How I can do this .... any suggestions ?