Hi!
I've previously been using MOXy in Eclipselink 1.1.2, but now a new project is starting so I want to evaluate how the new mapping-through-xml functionality in Eclipselink 2.1.1 works compared to the old way using descriptors.
I'm having a bit of trouble setting things up though. I'm currently trying this code:
Class[] supported = new Class[] {
com.foo.domain.model.Bar.class,
com.foo.query.BarRequest.class,
com.foo.query.BarResponse.class
};
Map<String, Source> mappingMetadata = new HashMap<String, Source>();
mappingMetadata.put("com.foo.domain.model", new StreamSource("/com/foo/domain/model/eclipselink-oxm.xml"));
mappingMetadata.put("com.foo.query", new StreamSource("/META-INF/eclipselink-oxm.xml"));
// Do you have to have one eclipselink-oxm.xml for each package?
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(JAXBContextFactory.ECLIPSELINK_OXM_XML_KEY, mappingMetadata);
jaxbContext = JAXBContext.newInstance(supported, properties);
This results in a FileNotFoundException: \META-INF\eclipselink-oxm.xml
I also tried changing the last line to
jaxbContext = JAXBContext.newInstance("com.foo.domain.model:com.foo.query", JAXBContext.class.getClassLoader(), properties);
but that gives me a javax.xml.bind.JAXBException: Provider org.eclipse.persistence.jaxb.JAXBContextFactory not found
Many of the wiki documentation pages refer to an example project in a zip file and points to the download page, but I can't find it anywhere. Such an example project would be a great help in getting things started.
Anyway, if someone could help me out, it'd be greatly appreciated.
Thanks!
/Matti