This works...how "expensive" is it, really? I've noticed in my own
testing that copying the contents of one ArrayList into another can be
fairly resource intensive...is that what is happening in the
constructor?
Couldn't I avoid this by making my domain classes implement
Serializable? I believe this is recommended by Hibernate anyhow to
uniquely identify objects in the second-level cache IIRC.
On Fri, 2006-02-10 at 21:24 -0800, Jens Schmidt wrote:
>
>
> Your exception most likely stems from this issue:
>
>
> The list view constructor that throws the exception looks like this:
>
>
> public ListView(final String id, final List list)
> {
> this(id, new Model((Serializable)list));
> }
>
>
> Since empList (java.util.RandomAccessSubList) does not implement
> Serializable you get the exception.
>
>
> A quick fix (but potentially expensive) would be to change your code
> to
>
>
> //list 1
> add(new ListView("employees", new ArrayList(empList))
> {
> ...
>
>
>
> Hope that helps,
> - Jens
>
>
> PS. From my experience Wicket (in my case version 1.1) works very well
> with JDK 5.0 and generics.
>
>
>
> On Feb 10, 2006, at 1:50 PM, VGJ wrote:
>
> > I'm trying to convert a single page of an existing application using
> > Wicket...just to see how it works. The entire app was built on JDK
> > 5.0. It uses hibernate and retrieves lists of data with
> > generics...and it may be what is causing my problems since I've
> > spotted a comment here and there that Wicket doesn't support Java
> > 5?
> >
> > It's a simple test...I've got my 3 files:
> >
> > CheckIn.html
> > CheckIn.java
> > CheckInApp.java
> >
> > Here's where I'm pulling a List from a proxy class in the
> > middle-layer of the application and trying to display it:
> >
> > public class CheckIn extends WebPage
> > {
> > public CheckIn()
> > {
> > //get default directory
> > Directory ed = DirectoryProxy.getDefaultWithEmployees();
> >
> > //get employees from directory
> > List<Employee> employees = ed.getEmployees();
> >
> > //list 1
> > add(new ListView("employees", empList)
> > {
> > // This method is called for each 'entry' in the list.
> > protected void populateItem(ListItem item)
> > {
> > //get employee object
> > Employee employee = (Employee)item.getModelObject();
> >
> > //other employee labels
> > item.add(new Label("firstName",
> > employee.getFirstName()));
> > item.add(new Label("lastName",
> > employee.getLastName()));
> > }
> > });
> > }
> > }
> >
> > Here's part of the exception I'm getting:
> >
> > ...
> > 14:25:09,613 ERROR RequestCycle:785 - Unexpected runtime exception
> > [page = null]
> > java.lang.ClassCastException: java.util.RandomAccessSubList
> > at
> > wicket.markup.html.list.ListView.<init>(ListView.java:135)
> > at com.portlets.ui.CheckIn$1.<init>(CheckIn.java:58)
> > at com.portlets.ui.CheckIn.<init>(CheckIn.java:55)
> >
> > Any ideas? Thanks!
> >
> >
>
>
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user