Importing XML data to a RDBMS

exercise No. 11

Reading XML, write using JPA

Q:

Read the given XML data example using JAXB and persist the corresponding objects to a RDBMS. This requires the following steps:

  • Use the JAXB schema compiler xjc accordingly to create domain classes corresponding to <catalog> and <cd> .

  • Create a JAXBContext and an Unmarshaller instance to parse valid <catalog> instances accordingly.

  • Supply JPA annotations to the xjc generated de.hdm_stuttgart.mi.sda2.jpa.cd.domain.Catalog class.

Hint: The Maven archetype standalone-jpa-eclipselink-archetype may help getting started with JPA configuration issues. You may want to add http://repo1.maven.org/maven2/archetype-catalog.xml to your list of archetype repositories.

A: