Hi, i know JAXB's handling of interfaces has been discussed quite a lot
but i wanted to get your opinion regarding an issue i'm having.
I'm trying to generate the XML types from java source using JavaCompiler
like this;
JavaCompiler jc = XJC.createJavaCompiler();
J2SJAXBModel model =
jc.bind(rootTypes, additionalElementDecls,
info.getDefaultNamespace(), env);
The source webservice endpoint has a method like this;
public List<Emp> queryEmpFindAll() {
return em.createNamedQuery("Emp.findAll").getResultList();
}
And during the call to JavaCompiler.bind () i get an
IllegalAnnotationException with the error message "java.util.List is an
interface, and JAXB can't handle interfaces.".
The rootTypes passed to bind() include; java.util.List and project1.Emp
classes.
I tried annotating the method with XmlJavaTypeAdapter (along with
XmlTypeAdapter);
@XmlJavaTypeAdapter(ListAdapter.class)
public List<Emp> queryEmpFindAll() {
...
with no luck (i even tried adding XmlJavaTypeAdapter annotation to the
list class itself).
I tested all this with JAXB 2.0.5-b02-fcs and 2.1.3-b01-fcs.
My understanding is that in JAXB 2.0 there is suppose to be support for
List and the specification says in section 8.5.4 that
collection must be supported:
java.util.Collection and it's subtypes (e.g. java.util.List)
Do you know if this usage is incorrect or not supported or if there's
something i'm missing.
Thanks,
-tim