Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
5.0.11
-
None
Description
The getAvailableRows() method is called multiple times while rendering the page. This is fine when it is just invoking size() on a List, but for a Hibernate query it is quite inefficient:
[INFO] AppModule.TimingFilter Request time: 1 ms
Hibernate:
select
count(account0_.ACCOUNT_ID) as col_0_0_
from
ACCOUNT account0_
Hibernate:
select
this_.ACCOUNT_ID as ACCOUNT1_0_0_,
this_.FIRST_NAME as FIRST2_0_0_,
this_.LAST_NAME as LAST3_0_0_,
this_.PASSWORD as PASSWORD0_0_,
this_.DATE_OF_BIRTH as DATE5_0_0_,
this_.COMMENTS as COMMENTS0_0_
from
ACCOUNT this_
Hibernate:
select
count(account0_.ACCOUNT_ID) as col_0_0_
from
ACCOUNT account0_
Hibernate:
select
count(account0_.ACCOUNT_ID) as col_0_0_
from
ACCOUNT account0_
Hibernate:
select
count(account0_.ACCOUNT_ID) as col_0_0_
from
ACCOUNT account0_
Hibernate:
select
count(account0_.ACCOUNT_ID) as col_0_0_
from
ACCOUNT account0_
[INFO] AppModule.TimingFilter Request time: 147 ms
[INFO] AppModule.TimingFilter Request time: 0 ms
[INFO] AppModule.TimingFilter Request time: 0 ms
Some care should be taken to ensure that the method is invoked once per request and the value cached.