Original address: http://www.xuebuyuan.com/210489.html
In the past has been used myelipse, in MyEclipse do hibernate reverse engineering is very handy.
But recently switched to eclipse, the beginning is not installed Eclipse plug-ins, tossing a few days finally installed, but will not use the disease reverse engineering
Finally found on a foreign site:
http://iablog.sybase.com/paulley/2009/02/reverse-engineering-sql-anywhere-with-hibernate-tools-part-trois/
I will introduce how to generate Hbm.xml and class methods:
Pre-conditions
1, has a project and has added Hibernate 3.x
2, there is a corresponding database. Just not linked up.
And then it's officially started.
1, add Hibernate.cfg.xml
Right-click the project-->new-->other---> Search (Hibernate) and select Hibernate Configuration File (cfg.xml)-->next--> Select the project name-->next--> fill in the necessary information to connect to the database-->finish
Figure:
2. Add Hibernate configuration:
Click Project-->new-->other---> Search (Hibernate)-and select Hibernate Console Configuration. The following interface will appear
3, added: Hibernate.reveng.xml
Right-click the project-->new-->other---> Search (Hibernate) and select Hibernate Reverse Engineering File (reveng.xml)-->next.
will appear as:
After completing the above steps, it will be created and opened: Hibernate.reveng.xml, do the following
Once added, save, close.
4, generate hbm.xml and beans.
Can only be seen in hinbernate mode.
In the specified directory we can see the generated file.
The error is because the package location is not specified: Open the file and add it.
Here the Lord is: as package com.polaris.fw.crud.test
[Turn]hibernate to generate hbm.xml and bean classes in Eclipse's reverse engineering