How to generate hibernate POJO classes programmatically?

Posted by Vatsala on Stack Overflow See other posts from Stack Overflow or by Vatsala
Published on 2010-04-05T17:35:04Z Indexed on 2010/04/05 18:43 UTC
Read the original article Hit count: 376

Filed under:
|

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....

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about java