[
https://issues.apache.org/jira/browse/WICKET-2318?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Igor Vaynberg resolved WICKET-2318.
-----------------------------------
Resolution: Invalid
Assignee: Igor Vaynberg
even though you have a setter(set) listmultiplechoice operations on a list and
so it gives you the selected choices in a list.
it can work with a collection if one is given, but if you give it a null model
it will try to push back a list because that is its native collection type.
there easiest and most proper thing to do is to have this in the constructor of
your user object
friends = new HashSet<User>();
just like you do already for roles,
failing that you can write a model that in its setobject() takes a collection
and transforms it into a set and then pushes it into the user.
> Creating a new HashSet from a ListMultipleChoice doesn't seem to work
> ---------------------------------------------------------------------
>
> Key: WICKET-2318
> URL: https://issues.apache.org/jira/browse/WICKET-2318
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4-RC2
> Environment: Windows Vista, Java 6
> Reporter: Linda van der Pal
> Assignee: Igor Vaynberg
> Priority: Minor
> Attachments: hashsetLMCTest.zip
>
>
> I have bound a HashSet to a ListMultipleChoice. This HashSet (with friends of
> a user) is part of a User object. The user is the model bound to the page.
> When using the LMC to update the user, everything works fine, but when using
> it to create a new user I get an exception: WicketMessage: Error calling
> method: public void
> nl.lunaris.bookdb.hashsetLMCTest.User.setFriends(java.util.Set) on object:
> TestUser.
> I'll attach a quickstart project that shows the issue.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.