Why does not JAXB bind java.util.Map properly but handles java.util.List
Ravi C Kota
Joined: Jan 29, 2008
Some where I read, in this forum that usage of Collections is not recommended as JAXB will not be knowing how to bind them. So, in order to understand the problem, I started writing a sample code. The code looks as below
So as seen above, I'm trying to see how the binding works for different kinds of object types. I ran the wsgen against the above code, but would end up with the exception
The exception is misleading here, as it sounds as if an Interface can not be used as a return type here. For that matter, List is also an interface and I do not see any issue for List. It is also failing for getDatabase() for the same reason as that of Map.
Using the Interface as the return type is the quite common and also highly respected way of coding. But apparently I'm missing something here to get it work. Can someone point me out the mistake I'm making here and a corrective action.
Thanks & Regards, Ravi C.Kota
SCJP 5.0, OCDJWS 5.0
Joined: Sep 03, 2005
This link may help in answering your question a bit