English 中文(简体)
预防数据 更新后检索旧数据的意见
原标题:Prevent DataView retrieving old data after it has been updated
  • 时间:2012-01-12 13:22:45
  •  标签:
  • java
  • wicket

I ve been having some problems with DataView that always retrieve the old data set. Even though the page has been re-loaded, IDataProvider has never been updated into the current state of the database. Here is how my IDataProvider looks like :

   private class MyDataProvider implements IDataProvider<Item> {

    private List<Item> list;

    private List<Item> getData() {
        if(list == null) {
            list = projectLogic.getItems();
            Collections.reverse(list);
        }
        return list;
    }


    @Override
    public Iterator<Item> iterator(int first, int count){
        return getData().subList(first, first + count).iterator();
    }

    @Override
    public int size(){
        return getData().size();
    }

    @Override
    public IModel<Item> model(Item object){
        return new DetachableItemModel(object);
    }

    /**
     * Detaches model after use. This is generally used to null out transient references that can be re-attached later. 
     */
    @Override
    public void detach(){
        list = null;
    }

}

每一(a)项已经将清单定为无效,但为何不影响我在数据概览中的供应商?

问题回答

给我看重。

项目记录仪系统是否每次都使用 d子? 你们是否在获得援助方面设置了突破点?





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签