wood burning stoves 2.0
The moose likes Object Relational Mapping and the fly likes [newbie] xsd to Jaxb to JPA using EclipseLink Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "[newbie] xsd to Jaxb to JPA using EclipseLink" Watch "[newbie] xsd to Jaxb to JPA using EclipseLink" New topic

[newbie] xsd to Jaxb to JPA using EclipseLink

Shawn Sebedang

Joined: Jul 20, 2012
Posts: 2
Hello guys. A newbie question:

I am a fresh graduate and currently studying for an upcoming project. The task is convert a set of XSD docs through JAXB to corresponding Java specs. Also generate the correct SQL table definitions. So the topics I am studying now are JAXB and JPA, decided I will be using eclipseLink and I have it all set up. What I don't understand is the workflow. From what I understood, it's
xsd -> jaxb classes -> annotate(JPA) -> database
I can now generate JAXB classes from an example XSD but I don't know what to do from there. I have read about generating JPA classes from a database but I don't have any resources on doing the reverse. Help would be appreciated

James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
You can persist the same JAXB generated class through JPA by adding @Entity and @Id annotations to them.
You can auto create a database schema using DDL generation in your JPA persistence.xml,



Normally it is better to design an object mode, then map it to XML and the database using JAXB and JPA annotations.

TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
Consider Paul's rocket mass heater.
subject: [newbie] xsd to Jaxb to JPA using EclipseLink
It's not a secret anymore!