2

I know that hbm2hbmxml generates the necessary mapping files (*.hbm.xml) from a given datasource. You can then use hbm2java which will use those hbm.xml files as an input and will output Java classes. Is there a way of generating Java Annotated classes from the datasource without having to rely on the hbm.xml files?

Thanks.

sebastianr
  • 657
  • 1
  • 7
  • 10
  • Check this out: https://jonamlabs.com/how-to-use-hibernate-tools-maven-plugin-to-generate-jpa-entities-from-an-existing-database/ – Manoj Reddy Sep 03 '20 at 14:39

1 Answers1

0

You can use hbm2java for reverse engineering. There are the hibernate tools docs:

http://docs.jboss.org/tools/3.2.1.GA/en/hibernatetools/html_single/index.html#refeng_codegen

With the reveng file configuration you can instruct hibernate tools to create the java model from the database.

And there is one example from another SO question:

How to configure maven hbm2hbmxml and hbm2java to run one after the other in mvn clean install

Community
  • 1
  • 1