Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate: @schema notation & how to generate schema from the domains?

 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just tackled this notation - schema

example


I wonder what does it mean and (not sure it relates...but) how is it possible to auto-generate a schema of classes from the domains?

example



Thank you!
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, one thing you need to know is that Hiberante won't create the schema. You need to create the schema manually, as in through the MySQL admin console. Once created though, Hibernate will connect to it, and create all of the tables and columns as you specify in your annotations.

It's always good to quote your sources. I'm sure alot of people here on JavaRanch would love to know where you got such a fine and handsome ERD diagram. I'd be really impressed if someone had managed to properly map all of those complex relationships with JPA annotations.



-Cameron McKenzie

Advanced Entity Mapping with Hibernate and the Java Persistence API (JPA) : A Tutorial

 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the source correction; I should have post it before (I learned something)

As per my question, you're saying that Hibernate cannot do it (auto-generate the ERD from the annotated pojos), so do you know any plugin that can do that?

When I used iBatis, it had 'abator' that connected to the DB and generated all the pojos/daos; I wonder what is the equivalent in Hibernate.

Also (hope I'm not asking too much) I like to create the pojo myself with annotations (so I know what's going on in terms of composition, foreign keys etc) and create the db & ERD (auto-generated).

Thanks for any help!


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic