I hate using non-licensed tools. generally when it comes to code generation for Hibernate, pple tell of myeclipse; and heres the way to do it. Myeclipse usage requires licenses; so this is how pple get around it –uninstall it just before the trial expires and reinstall it again.
I hate all this crappy stuff and wanted a clean way to do it. I have used eclipse helios for this and guess it would work for other eclipse versions as well
- in eclipse help > install new software > give the url: http://download.jboss.org/jbosstools/updates/stable/helios/ and hibernate - http://download.jboss.org/jbosstools/updates/development
- say you added link 1, click on next and select all options then click on finish
- then redo the above for the link 2 aswell.
Now the hibernate plugin is installed. Below i tell the steps to auto genrate the code
- File > new > others > hibernate > new Hibgernate console configuration file
- select the project name, configurae a new db connection, property file, configuration files (all will take abt 1 min to complete)
- similarly do File > new > others > hibernnate > new hingernate cfg.xml
- similarly do FIle > new others > hibernate > new reverse engineering file
- fill the step 1
- the step2 click on refresh after having selected the console configuration file in the dropdown
- select the table u r looking for
- incase ur table has foreign keys select the paret table also
- click on finish
- Inthe top bar (where u see save, print icos) u should see a new RunAs icon ( in black suffix)
- click on it you wil see a drop down
- select hibernate code generation configurations
- now double click on hiberante code generation (in the left tree)
- in the right side select consolef configuration
- select a temp directory, reverse engineering file we already created
- and say run; Bingo.. the code generation is done.
Now the qn: why did they build the plugin so complicated? why not have it a siimple one? all of it done in a wizard??? i donk know…
let me know if it helped you.