我有一个HQL查询,如下所示,返回ORDER的java.util.RandomAccessSubList。 SubList的偏移量为1,因此无法访问查询结果列表的第一个元素。
SELECT vendor.order FROM OrderVendor vendor WHERE vendor.user.id=? ORDER BY vendor.order.creationTime desc
select order1_.order_id as order1_18_,(..... other fields....)
from ORDER_VENDOR ordervendo0_
inner join ORDER order1_ on ordervendo0_.order_id=order1_.order_id,
where ordervendo0_.user_id=?
order by order1_.creationTime desc
我尝试了另一种方式。首先获取OrderVendor的List,然后使用OrderVendor.getOrder()方法访问订单。但是有点挑剔!
FROM OrderVendor vendor WHERE vendor.user.id=? ORDER BY vendor.order.creationTime desc
select ordervendo0_.vendor_id as vendor1_20_ (....other fields...)
from ORDER_VENDOR ordervendo0_,
ORDER order2_
where ordervendo0_.order_id=order2_.order_id
and ordervendo0_.user_id=?
order by order2_.creationTime desc limit ?
我的问题是为什么第一个查询返回一个SubList以及为什么SubList的偏移量是1?
谢谢!
Geln