aspose file tools*
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 Java 8 in Action this week in the Java 8 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
Author

[newbie] xsd to Jaxb to JPA using EclipseLink

Shawn Sebedang
Greenhorn

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,

see,

http://www.eclipse.org/eclipselink/documentation/2.4/jpa/extensions/p_ddl_generation.htm#BABHEJJI

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [newbie] xsd to Jaxb to JPA using EclipseLink
 
Similar Threads
without xml schema, generate java classes from xml data file ?
Newbie question - conversion of incoming XML document into generated object graph
How to read from XSD generated database and put that data into XML file.
Combine JAXB + JPA?
How To Add Hibernate Facet To Eclipse Galileo JPA Project?