dev@jaxb.java.net

annotation issue

From: Livnat Sharabani <livnats_at_gmail.com>
Date: Sun, 6 Sep 2009 14:38:12 +0300

Hi All,
I am working on jboss 5.1and exposing a web-service.
The serialization is done using the native jboss stack which uses JAXB.
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 -

*_at_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,