0 Replies Latest reply on Dec 18, 2006 12:00 AM by JBoss Fan

    In selectItems, how to synchronize objectId for selected val

    JBoss Fan Newbie


      I'm using SelectItems approach from http://wiki.jboss.org/wiki/Wiki.jsp?page=SelectItems

      The problem: when displaying a form with pre-existing selected values, the objectsId in the list of SelectItems will be different than the forms parent object that holds the reference to the selected object.

      Therefore the hashes don't match in this code (ReferenceConverter class)

       int hash = Integer.valueOf(str).intValue();
       for (Object val : values) {
       if ( val!=null && val.hashCode()==hash ) {
       return val;
       }
       }
      


      As I feel this problem is conceptual, not sure how to synchronize the objectId for the selected value and the one value in the list of Select Items?

      Please let me know if you have any suggestions, how to tackle this one.
      Thanks for your help

      Yeyo