Java wicket dataprovider for large tables size -


I am developing a wicket front end with an MySQL database for an EJB3 Java application. The website is submitting mostly forms and showing the table. For these tables I prefer to create IDataProviders which works very well with AjaxPaging Navigation. But I have some tables which are quite large and it becomes a bit difficult to implement the size function of the IDataProvider, usually I use a count for the query and it performs well in most cases, but my Have some large tables where a count is too high (3s +). Now there are some options that I can use but I'm not really happy using any of these, so I ask, does anyone know a great solution to implement the size of a larger table () function?

The first option I found on Google used a subquery with threshold results, which makes a count. But since I mainly use named queries and EJB3, it seems a hack and if there is some change it can be difficult to maintain it.

The second option uses a ListDataView and just does a limited query on the table and it requires a big count query. This solution is my favorite yet, but it is not the best because it is almost ) Receives the maximum amount of the record. I should choose between archiving this list object or querying the database between queries again.

The last option I found was cheating options. I have not applied it but I can create the size of idaprrrrrrrrrr functions () such as some pages + 1 It brings some other problems such as the number of pages in which there are records, there are checks for catching them but it is also dirty.

Does anyone know of a great solution to use the IDataProvider in the wicket to show the paged table of large database tables?

Many thanks, Martin

I have implemented a grid view with the data provider IterableGridView

Here is the code:

The Iterable grid view is based on the GridView of the wicket >, but it < Code> IDataProvider , but with IterableDataProvider . This new data provider relies only on plain Java iterator - size information is not required, and there is no need to create range iterators for each page.

  final list & lt; String & gt; MyGridData = New Arrielast & lt; & Gt; (); MyGridData.add ("value1"); MyGridData.add ("value2"); IterableDataProvider & LT; String & gt; IterableDateProvider = Newer EthernetDeteller & lt; String & gt; (10) {@ Override Protected Iterator & lt; String & gt; Iterator () {myGridData.iterator (); } @ Override Public Emodel & lt; String & gt; Model (strings) {return model. (s); } @ Override Public What Detach () {}}; IterableGridView & LT; String & gt; MyGrid = New IterableGridView & lt; String & gt; ("MyGrid", iterableDateProvider) {@ Override Protected Zero Populate Eleitem (item & lt; string & gt; items) {item.add (new label ("myValue"); } @ Override protected zero populated item (item & lt; string & gt; items) {item.add (new label ("myValue", item.getModelObject ()); }}; Add (myGrid); MyGrid.setItemsPerPage (10); // You will need to use custom pager and not Ajax pageing navigator IterablePagingNavigator pager = new interseal paging newvigator ("Rownameslist pager", list of row names); ResultTable.add (pager);  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -