Results 1 to 2 of 2

Thread: Index on beanpath when using Sets

Hybrid View

  1. #1
    Join Date
    May 2006
    Location
    Zug, Switzerland
    Posts
    89

    Default Index on beanpath when using Sets

    Hi all

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

    customer[0].name

    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.

    Thanks
    Simon

  2. #2
    Join Date
    Jun 2005
    Posts
    4,232

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •