maven - How to implement a roundtrip from XML Schema using Java with a Database -
what best way of implementing roundtrip receiving xml files , persisting data database using java. have:
1. xml schema & xml data files send me
- xsd complex , belongs external party, can not change it
2. created java classes
- jaxb generates on 150 classes, unfortunately schema can change
- have used maven pom automate process 3. unmarshall xml data files java objects (with jaxb annotation)
- data displayed user manipulated
4. persist java objects rdbms (oracle / mysql)
- seems jdo suitable solution
5. exporting data
- data can exported again xml or excel (for example)
i can not find suitable way add jdo metadata or annotations java source code (generated during jaxb process) ensure can persist java classes. working following technologies:
- java, maven, jaxb, jdo & jdbc
i think datanucleus suited might have change datastores (rdbms / xml / excel) between environments different export destinations. other 2 technologies might need consider is:
- spring , xdoclet
advice or pointer tutorial appreciated
what best way of implementing roundtrip receiving xml files , persisting data database using java.
for use combination of jaxb , jaxb. note: lead eclipselink jaxb (moxy), eclipselink provides excellent jpa implementation.
currently have:
1 - xml schema & xml data files send me
- the xsd complex , belongs external party, can not change it
option #1 - start xml schema
- if want start xml schema can use jaxb's external binding file customize class generation needed without modifying third party xml schema.
option #2 - start java classes
- you can start jpa entities , map them xml schema.
- moxy offers xpath based mapping extension can make mapping easier: http://bdoughan.blogspot.com/2010/09/xpath-based-mapping-geocode-example.html
2 - created java classes
- jaxb generates on 150 classes, unfortunately schema can change
- i have used maven pom automate process
if xml schema changes can regenerate model, or annotate model necessary handle modifications xml schema.
you may find hyperjaxb project useful, believe generate jpa annotations right onto jaxb model.
3 - unmarshall xml data files java objects (with jaxb annotation)
- the data displayed user manipulated
this normal jaxb usage. example see:
4 - persist java objects rdbms (oracle / mysql)
- it seems jdo suitable solution
jpa alternative.
5 - exporting data
- the data can exported again xml or excel (for example)
again normal jaxb usage xml output.
Comments
Post a Comment