Alex Rivera | Logout

Java: XML into a Database, whats the simplest way?

Asked 2010-11-22T17:37:38.313
11

I have a load of XML files, and an XSD for them.

I'd like to simply convert then into POJO's and insert them into a database. The DB schema is under my control, so it can be what ever I like.

I've looked around at a load of apis, but wanted another opinion what works best.

  • JAXB?
  • XMlBeans?
  • XPATH to DBUnit?

Does hibernate have some api to create POJO's from an XSD, then read the XML into those POJOs, and then insert the data into the database?

Or does spring have any features to help with this?

I guess I'm just after your views, just incase there is an API I've missed that will do help do what I want.

Thanks Jeff Porter

Edit
Report

1 Answer

0

A common approach would be to use JPA (i.e. EclipseLink or Hibernate) to store the objects into the database, and JAXB (i.e. Metro, EclipseLink MOXy (I'm the tech lead), or JaxMe) to convert the objects to XML.

EclipseLink JAXB (MOXy) has a number of extensions for mapping JPA entities to XML:

answered 2010-11-22T18:14:02.760

Your Answer