I have the following questions concerning code generation for Hibernate annotated 开发者_JAVA技巧DTO/DAO-s:
Is it possible to use a reverse-engineering tool such as hibernatetool to generate DTO/DAO-s along with annotations (as opposed to the xml configuration, I have seen working).
If there is such a tool, is there a Maven plugin which can be used as well?
If Hibernatetool only supports xml based configuration (and there is no other tool which can generate annotated classes), why doesn't hibernatetool support this, if the framework has already been supporting annotations for such a long time?
I know there are tons of code generators out there (from sql4java to oAW and firestorm). But I am looking for a good code generator that can produce DTO/DAO-s from an existing database, instead of having to use UML for this. If this generator can produce Spring configurations as well, it would be great.
Thanks for your time,
Martin
You can try Telosys Tools, an Eclipse plugin for code generation working from an existing database with customizable Velocity templates
See: http://sites.google.com/site/telosystools/ Eclipse Marketplace : http://marketplace.eclipse.org/content/telosys-tools
This tutorial includes JPA entities generation : https://sites.google.com/site/telosystutorial/springmvc-jpa-springdatajpa
Not sure what you mean by reverse eng in this context but Spring-Roo does every thing that you seem to be needing .Spring-Roo generates complete boiler plate code including DAO .
You could have a look at Spring Roo a database reverse engineering tool for DB to Spring configurations. There exists an eclipse integration, so that you can do that from within eclipse.
The Eclipse-based JBoss Tools can generate JPA-annotated entities for you (but not DAOs, I think).
As usual for Hibernate projects, the documentation is confusing and hardly understandable, but the functionality is there.
There are also a set of Ant tools which have been ported to a Maven Plugin. Here's the ant version of what you probably need (the docs for the maven version are virtually non-existing)
精彩评论