Re: Serializable check

2009-11-05 Thread bht
Thanks very much! As pointed out, I was incorrectly using the keyword volatile instead of transient. All is well now with IDataProvider and SerializableChecker. SerializableChecker is great! Bernard On Thu, 5 Nov 2009 22:30:59 -0800, you wrote: >class mydataprovider implements idataprovider {

Re: Serializable check

2009-11-05 Thread Igor Vaynberg
class mydataprovider implements idataprovider { private transient list cache; private list getresult() { if (cache==null) { // load the list from db; cache=list; } return cache; } public iterator iterator() { return getresult().iterator(); }

Re: Serializable check

2009-11-05 Thread mbrictson
I think the problem is that you are using the "volatile" keyword when you should be using "transient". bht wrote: > > So I wonder, what is the situation with SerializableChecker > complaining about that volatile field not being Serializable. Is this > a bug or do I miss anything? > -- View t

Re: Serializable check

2009-11-05 Thread bht
Hi James, Thanks for the question. In this case, yes. In other cases where I use IDataProvider, no. I know that IDataProvider provides functionality for pagination which I don't use here, that is why I ignored it. I must admit I have a few issues with IDataProvider but I don't want to distract f

Re: Serializable check

2009-11-05 Thread James Carman
Are you always retrieving the entire list? On Thu, Nov 5, 2009 at 11:25 PM, wrote: > Igor, > > Creating the list of entities exclusively inside iterator() requires > two database calls for retrieving a list for a single request, the > additional call being required for the size() method that is

Re: Serializable check

2009-11-05 Thread bht
Igor, Creating the list of entities exclusively inside iterator() requires two database calls for retrieving a list for a single request, the additional call being required for the size() method that is called prior to iterator(). That is an unfortunate side effect of this API. I don't have a pro

Re: Serializable check

2009-11-05 Thread Igor Vaynberg
you should create the list of entities inside iterator() call, not hold on to it in a field. see the phonebook example. -igor On Thu, Nov 5, 2009 at 7:06 PM, wrote: > Thanks again Igor. > > I have switched to plain IDataProvider as suggested, although I have > to admit that I still have to look

Re: Serializable check

2009-11-05 Thread bht
Thanks again Igor. I have switched to plain IDataProvider as suggested, although I have to admit that I still have to look at the phonebook example. Again, IDataProvider is an improvement, but still not good. It appears that SerializableChecker is complaining about a volatile field not being Ser

Re: Serializable check

2009-11-05 Thread Igor Vaynberg
no, you should not be using listdataprovider, it is only for static lists of things. if you want best practice look at the phonebook example in wicket-stuff. -igor On Thu, Nov 5, 2009 at 5:52 PM, wrote: > Igor, > > Thanks very much for your suggestion which I followed. > > I have overridden it

Re: Serializable check

2009-11-05 Thread bht
Igor, Thanks very much for your suggestion which I followed. I have overridden it and that is an improvement but still not good. ListDataProvider dataProvider = new ListDataProvider(myList){ @Override public IModel model(Object object) { return new DetachableMyEntityModel((My

Re: Serializable check

2009-11-05 Thread Igor Vaynberg
you have to override listdataprovider#model and return a detachable model. -igor On Thu, Nov 5, 2009 at 2:19 PM, wrote: > Hi, > > I am trying to prevent the leaking of business objects into the > session. > > Michael made a good comment in > > http://www.mail-archive.com/users@wicket.apache.org

Serializable check

2009-11-05 Thread bht
Hi, I am trying to prevent the leaking of business objects into the session. Michael made a good comment in http://www.mail-archive.com/users@wicket.apache.org/msg31187.html "... you could e.g. temporarily remove the "Serializable" from your model-classes and go spotting nonserializable excepti

Re: label fails serializable check when i override model().getObject (wicket 1.3.6)

2009-08-28 Thread Igor Vaynberg
final _isgraph=isgraph; graphLink.add(new Label("graphLinkLabel", new Model() { @Override public Object getObject() { return _isgraph ? "List" : "Graph"; } })); -igor On Thu, Aug 27, 2009 at 12:19 PM, james o'brien wrote: > I'm trying to cha

label fails serializable check when i override model().getObject (wicket 1.3.6)

2009-08-27 Thread james o'brien
I'm trying to change the text of label based on whether a flag is set for graph or not graph. graphLink.add(new Label("graphLinkLabel", new Model() { @Override public Object getObject() { return isGraph ? "List" : "Graph"; } }));