File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Hibernate: @schema notation & how to generate schema from the domains? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate: @schema notation & how to generate schema from the domains?" Watch "Hibernate: @schema notation & how to generate schema from the domains?" New topic
Author

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

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
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

Joined: Aug 26, 2006
Posts: 4968
    
    1

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

Joined: Sep 10, 2004
Posts: 755
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!


 
GeeCON Prague 2014
 
subject: Hibernate: @schema notation & how to generate schema from the domains?