Reputation: 11
Is there any way or any utility to generate hibernate mapping files or directly the database tables from POJOs. I cannot manually insert hibernate annotations since these POJOs are generated dynamically in my application. Please suggest a solution.
Upvotes: 1
Views: 2182
Reputation: 11
What I do is this:
It works everytime and using Grails is fast and VERY easy to use.
Upvotes: 0
Reputation: 22190
Alternatively you could change your code generation in your application to include the javax.persistence annotations.
Upvotes: 1
Reputation: 3272
Instead of using annotations you could also use 'old fashioned' .hbm.xml mapping files. This is the classic way of defining a mapping with Hibernate which uses an external xml file to describe the mapping. You could generate the mappings at the same time when you generate your POJOs. Or if the POJO generation is done by external code you could add this yourself.
Once you have a mapping you can use the standard Hibernate facilities to create/upgrade the database schema...
Upvotes: 1