Beginner |
|
Joined: Mon May 24, 2004 7:39 pm Posts: 37 Location: Charlotte
|
Hibernate version: 2.1.7
I would like to use hsql to gain the benefit of automatic joining and cacheing but would like to embed sql to use the "top" command. I know that top can usually be replaced with setMaxResults() but, in this case, it is a sub query (using MS SQL 2000). Is there any way I can do this?
select distinct o.DisputedHolding
where o.MeasuredParam.Name = 'Price'
and o.DisputedHolding.holdingDate in (
/* I would like to embed the following as actual SQL */
select top 5 holding_date from src_holding_imp
where holding_date < :date
order by holding_date desc
/* end of embedded sql */
)
group by o.DisputedHolding
having count(*) >= 5
Any help would be greatly appreciated.
Joe
|
|