0
我都已經設定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;
}
訣竅是internalOrder其中最高internalOder值呈先的實體,稱爲ServiceList .. 當我做我的Hibernate查詢我喜歡這...
{
List<ServiceList> lists = (List<ServiceList>) JPA.em().createQuery(
"select distinct list from com.vionlabs.movieoncloud.model.main.ServiceList list " +
"left join fetch list.productServiceListOrders " )
}
我的問題是: - 我想設置一個上限左連接,這意味着我想,當我做了查詢以獲得最高只有10個productSeriveListOrders ......我該怎麼做.. .. 有什麼建議麼 ?