File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[newbie] xsd to Jaxb to JPA using EclipseLink

 
Shawn Sebedang
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 553
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic