Results 1 to 2 of 2

Thread: Hibernate Command Object with Set Field

  1. #1
    Join Date
    Aug 2004
    Location
    New York
    Posts
    168

    Default Hibernate Command Object with Set Field

    I am using a Hibernate code generated bean as a command object in my Spring MVC web application. The command has a field which is of type java.util.Set which needs to be represented in the form. This seems difficult, however, because a Set cannot be represented as an indexed property since it is not indexable (doesn't implement java.util.List). I do not want to convert this field to a List because in Hibernate this would require an additional index column on the child table even though we don't care about ordering.

    Is there a way to represent a java.util.Set field in a form?

    Thanks

    karl

  2. #2
    Join Date
    Aug 2004
    Location
    Roeselare, Belgium
    Posts
    16

    Default

    If you're using JSTL, you can use
    Code:
    <c&#58;forEach var='item' items='$&#123;mySet&#125;' varStatus='status'>
    <option id="<c&#58;out value='$&#123;status.index&#125;'/>" value="<c&#58;out value='$&#123;item.id&#125;'/>"><c&#58;out value='$&#123;item.value&#125;'/></option>
    </c&#58;forEach>
    Of course the same effect can be reached by simply using Java scriptlets like with mySet.iterator().
    Pieter Coucke
    Onthoo.com

Similar Threads

  1. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  2. Replies: 0
    Last Post: Jun 29th, 2005, 12:19 PM
  3. Replies: 3
    Last Post: Nov 19th, 2004, 07:16 PM
  4. Replies: 9
    Last Post: Sep 25th, 2004, 12:35 PM
  5. Replies: 7
    Last Post: Aug 21st, 2004, 03:42 AM

Posting Permissions

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