Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » MOXy example missing?
MOXy example missing? [message #558563] Mon, 13 September 2010 10:01 Go to previous message
Matti Hansson is currently offline Matti Hansson
Messages: 68
Registered: July 2009
Member
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
 
Read Message
Read Message
Read Message
Previous Topic:Query with multiple matches in collection
Next Topic:Are UnitOfWork#hasChanges side effects a bug?
Goto Forum:
  


Current Time: Sat May 18 10:58:00 EDT 2013

Powered by FUDForum. Page generated in 0.05794 seconds