开发者

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

What's the best/easiest way to generate *.hbm.xml files f开发者_如何转开发rom pojos?


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜