You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by nivs <sh...@gmail.com> on 2010/11/30 07:24:14 UTC

PageableListView to work with Set

Hi

I have a question related to using a collection (Set) within a
PageableListView. At runtime I get an exception

java.lang.ClassCastException: org.hibernate.collection.PersistentSet cannot
be cast to java.util.List
at org.apache.wicket.markup.html.list.ListView.getList(ListView.java:177)

The entity structure is like this

public class Subject{

  String firstName;
  Set phones;
}

I guess it expects only a List type object. I can work around this by
converting the Set into a List and then provide it but felt somehow this is
a limitation. How can I work with generic collections?

Any thoughts much appreciated

thank you
Regards

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageableListView-to-work-with-Set-tp3064909p3064909.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: SV: PageableListView to work with Set

Posted by nivs <sh...@gmail.com>.
Hi Thanks for the link. Would have to use a repeater to support more generic
ones. Thanks
niv
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageableListView-to-work-with-Set-tp3064909p3068641.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: SV: PageableListView to work with Set

Posted by Alexander Monakhov <do...@gmail.com>.
Hi.

See Java Doc for PageableListView
http://wicket.apache.org/apidocs/1.4/org/apache/wicket/markup/html/list/PageableListView.html
and it's ascendant
http://wicket.apache.org/apidocs/1.4/org/apache/wicket/markup/html/list/ListView.html.

>From Java Doc:

A ListView is a repeater that makes it easy to display/work with
Lists. However, there are situations where it is necessary to work
with other collection types, for repeaters that might work better with
non-list or database-driven collections see the
org.apache.wicket.markup.repeater package.

Best regards, Alexander.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: SV: PageableListView to work with Set

Posted by nivs <sh...@gmail.com>.
So I gather from your response that I should use a list type object only.
Since PageableListView uses it for indexing,sorting etc. Am I right then to
convert either the entity to use a List or on the front end to map from a
Set into a List.
Thanks for the time
Niv
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageableListView-to-work-with-Set-tp3064909p3064992.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


SV: PageableListView to work with Set

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> I guess it expects only a List type object. I can work around this by
> converting the Set into a List and then provide it but felt somehow this is
> a limitation. How can I work with generic collections?
> Any thoughts much appreciated

No, because ordering requires the indexing a List has. In theory, you could make an IteratorView which uses the Iterator from a generic collection, but you would abandon things like paging, sorting etc. which rely on indexability.

- Tor Iver

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org