Upgradingdave
Upgradingdave

Reputation: 13076

Generate Hibernate Mapping Files (*.hbm.xml) from POJOS?

What's the best/easiest way to generate *.hbm.xml files from pojos?

Upvotes: 2

Views: 6102

Answers (3)

kabuski
kabuski

Reputation: 11

The way I get around this short coming is to use 1) Grails to generate the pojos. Any scaffolding framework would suffice. 2) Then Eclipse to reverse engineer the database tables into pojos.

Works everytime.

Upvotes: 1

Kaleb Brasee
Kaleb Brasee

Reputation: 51965

You can use xdoclet to do this. Or you can use Hibernate's JPA implementation (Hibernate Annotations), add annotations to your POJOs, and get rid of the .hbm.xmls once and for all.

Upvotes: 1

Jherico
Jherico

Reputation: 29240

Pojo's don't have an inherent ORM mapping. Mapping files (or mapping annotations) are the 'value added' of hibernate. If you really wanted to try something like this you could annotate all your classes with @Entity and try to get hibernate to generate schema based on this.

Upvotes: 1

Related Questions