I generate .hbm.xml
mapping files and .java
files from the DB schema, with Hibernate Tools. My question is, that is there any option, to generate service classes also? These are the classes where I implement the store(), find(), delete(), etc... methods.
I know that for C# there are many solutions to generate almost everything. I'm looking for the same, but with Hibernate. Is there any?
Generating "services" doesn't make much sense for me as services typically implement business logic (that Hibernate can't magically generate).
Now, if what you mean is data access code i.e. DAOs (exposing and implementing CRUD methods and finders), then the Hibernate Tools can do that. That's the DAO code (.java) option on the capture of the Eclipse plugin shown below:
alt text http://docs.jboss.org/tools/2.0.0.GA/hibernatetools/en/html/images/codegenexporters.png
The equivalent Ant Task is hbm2dao
.
But I personally don't use this feature and I'd go duffymo's way.