Announcement Announcement Module
No announcement yet.
Index on beanpath when using Sets Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Index on beanpath when using Sets

    Hi all

    If I have a Set of say customers, and I update


    via BeanWrapper, which element gets updated? Does the index point to a (pseudo-)random element (i.e. the same order the Set will return elements in a for-loop), or does Spring use a SortedSet internally for this type of access? (the Set is created as a PersistedSet from Hibernate)

    I'm thinking about writing out beanpaths to a webpage and then - on submit - update data based on that beanpath (security is, obviously, not an issue here)

    Just wondering if anyone knows that right away, otherwise I'll look into the Spring source code later on.


  • #2
    The BeanWrapper iterates through the Set and uses the first element. There is no other way for Spring to impose an order on a Set. It is usually deterministic, depending on the Set implementation I guess, but quite reliably so for JDK implementations, so it normally does what you seem to want it to in a web binding.