Hello,
I have two tables. among many ..
1. DiscountGroup (id, name, text, maxdiscount …)
2. Articles. (id, name, …, discountgroupid ) discountgroupid is a foreign key to DiscountGroup(id).
Discount Group has a 1:M relationship with the Articles (or Products) table.
DiscountGroup has about on average 3000 records
Articles have on average about 90,000 records.
The user has the authorization to modify only the articles (about 3000) he has permission to, but he needs to browse through all 90,000 records. We are planning to use the pagination feature of Hibernate and display the records to the user in a web based HTML table format. The user has the opportunity to browse through 100 records at a time and use the NEXT, PREV link to browse through the next set of records.
We will use the Hibernate pagination feature to implement the browsing feature. So we will use a similar query as below to get the next 100 records...
1) Query query = session.createQuery(“from Articles as art”);
query.setFirstResult(0);
query.setMaxResults(100);
For Articles we need to get the maxdiscount for the article, from the DiscountGroup table. So we want to lazily resolve the DiscountGroup associated with the Article
2) art.getDiscountGroup().getMaxDiscount(); and
art.getDiscountGroup().getName();
Will a query cache help in case of (1).
In such a scenario (2) will a second level cache help ?.
The ideal would be if I have about 30,000 articles in a second level cache. So browsing through the Articles will not involve a Database hit.
Thanks in advance.
|