Hi I am aware of the Hibernate Eclipse plugin that helps us (through a series of screens and button clicks) to generate the POJO and DAO classes for the underlying tables. But I would like to mimic this in a runtime environment, i.e. I would like to be able to do the exact same steps programmatically , where I should be able to supply the .cfg.xml file, the reveng.xml file, the database URL, the destination folder, via a command line/ parameters within main(String[] args)..
Apparently there is no such tool available which works in a pure Hibernate scenario. There is one which is tuned to generate code for the spring framework – but thats not of direct use to me right now.
I tried downloading hibernate-tools.jar’s source code for the eclipse plugin, but right now the src code download link at hibernate.org(new design) has been disabled for some reason.
Has anyone handled such a thing before? Or can you give me some clues to do this?
I have tried a certain JDBCReader class’s object, the rationale being read all tables using JDBCReader’s methods and then figure out how to use hbm2POJO generator class….
The Hibernate Tools for Eclipse and Ant are usable from both Eclipse and Ant, respectively through an Eclipse plugin and through an Ant task and both share the same underlying classes that you can reuse “programmatically” (I’m not sure to understand what you’re trying to do though).
You can get Hibernate Tools sources from JBoss subversion repositories. More precisely, checkout the following project: http://anonsvn.jboss.org/repos/hibernate/trunk/HibernateExt/tools/. The classes you’re looking for are in
org.hibernate.tool.hbm2x.*.