0 Replies Latest reply on Sep 7, 2009 10:49 AM by livnats

    jaxb annotaion and hashmap

    livnats

      Hi,
      I am working on jboss 5.1and exposing a web-service.
      The serialization is done using jbossws-native-3.1.2.GA.
      I am getting a different behaviour while serializing the same java bean once using the annotation (Hashmap is not recognized) and the other time using the defaults (HashMap is recognized).

      The bean is -

      public class AsyncQueryResults {

      private HashMap<String, DiskImageTemplate> testmap;

      public HashMap<String, DiskImageTemplate> getTestmap() {
      return testmap;
      }

      public void setTestmap(HashMap<String, DiskImageTemplate> testmap) {
      this.testmap = testmap;
      }
      }

      DiskImageTemplate is another bean and i think is not relevant to the issue.

      while generating the wsdl for this bean without annotation i get the following -
      <xs:complexType name="AsyncQueryResults">
      <xs:sequence>
      <xs:element name="testmap">
      <xs:complexType>
      <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="entry">
      <xs:complexType>
      <xs:sequence>
      <xs:element minOccurs="0" name="key" type="xs:string"/>
      <xs:element minOccurs="0" name="value" type="tns:diskImageTemplate"/>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>

      If i use annotation -

      @XmlAccessorType(XmlAccessType.NONE)
      @XmlType(name="AsyncQueryResults")
      public class AsyncQueryResults {


      @XmlElement(name = "testmap")
      private HashMap<String, DiskImageTemplate> testmap;

      public HashMap<String, DiskImageTemplate> getTestmap() {
      return testmap;
      }

      public void setTestmap(HashMap<String, DiskImageTemplate> testmap) {
      this.testmap = testmap;
      }

      }

      I get the following -

      <xs:complexType name="AsyncQueryResults">
      <xs:sequence>
      <xs:element minOccurs="0" name="testmap" type="tns:hashMap"/>
      </xs:sequence>
      </xs:complexType>


      Any idea what is going on? Is it a bug or did i miss something?


      thank you,