This content has been marked as final. Show 8 replies
you can create secondary iterator and manipulate that. It would be great if you can explain the use case before trying it out.
I am tryhing to implemnent pagination for the ADF table..i have implemented some command buttons like 1,2,3,...Next,Previous..
Intially i am showing first 10 records on page load. So now if user clicks on 3 , i have to show the records from 30 th to 40 th in the table by refreshing iterator..
here i could not get the how to set this to the iterator/vo .(we can acheive it by giving rownum in the VO query. but as per my knowledge rownum is not suggestable right.)
Note: same logic i have implpemented ADF with EJB ..In EJB Query class we have setFirst(int) and setMaxResult(int) methods...simply i did setFirst(30) and setMaxResult(10)..It worked fine...
Hope u got it now..Let me knw if have any Q..
If this is for pagination, then af:table offers pagination by design when you set accessmode=RangePaging or RangePagingIncremental in VO. Paginated queries are fired when scroll down in the table. Explore this option before you try out any custom solution
To answer the question,
Note: same logic i have implpemented ADF with EJB ..In EJB Query class we have setFirst(int) and setMaxResult(int) methods...simply i did setFirst(30) and setMaxResult(10)..It worked fine...Theoretically speaking the same can be achieved by setting setRangeStart() on the viewobject(which in turn sets to the default rowset) and by setting max fetch size on VO + accessmode=RangePaging. However when you use table with ADF binding, these will be overridden by the binding layer. If you are not using ADF binding, then the above is same as what you did for JPA entity. Other option is, you build expert mode VO with rownum for this special case, which will work if you dont need to set accessmode=RangePaging for VO.
Thanks for reply.
I tried the option setting accessmode= rangePaging. If we use this ,VO is internally using ROWNUM.
Here is the example generated query :
SELECT FROM (SELECT /*+ FIRST_ROWS */ IQ.*, ROWNUM AS Z_R_N FROM*
*(SELECT a.EMP_ID, a.EMP_NAME,*
aJOB, Aemployee.PHONE, a.SALARY FROM AEMPLOYEE a) IQ WHERE ROWNUM < :Bind_RangePage_High) WHERE Z_R_N > :Bind_RangePage_Low
But i m trieng out the ways without using the ROWNUM as im feeling that rownum gives performence issue.
Its sequence to the previous mail Jobinesh.
For the previous query how to pass those bind variables?
my intention is trying to utilize the Framework.
I have written db query in VO like below
*(select a.*, rank()*
over (order by emp_id asc ) rnk
from Aemployee a)
where rnk >= :first and rnk <= :second
Would it be there any performance issue? which is good practise?
If this requirement is common across your application, then my suggestion would be make use of the framework feature for the same. I don't think use of rownum got any noticeable performance issue as such. A lots of appln's and frameworks use this feature to paginate records. You can compare the execution plan for the queries to see whether it causes any performance issue
Thanks for the reply.
finally i have set access mode to the range pagiing instead of using rownum .As u said its better to use FW feature first.
Thanks once again..