Hibernate reverse engineering eclipse tutorial:-
Hello friends,
please gone through all steps if you want to learn reverse hibernate engineering.
This tutorail is about how we use hibernate reverse engineering in eclipse
please gone through all steps if you want to learn reverse hibernate engineering.
This tutorail is about how we use hibernate reverse engineering in eclipse
first you have to download JBoss Tools by eclipse market place or either by install ..
Goto this link : http://download.jboss.org/jbosstools/updates/stable/
Select one option. Here i selected following option because i am using Eclipse Indigo ::: >>
JBoss Tools 3.3 Development Milestone (requires Eclipse)
Now copy page URL and Goto Help > Install New Software.. paste URL in Work with Textbox as shown in below image.
Create Project Structure as shown in below image:-
And pacakage com.rev.model
After that then Add Additional jars:-
1.hibernate3.jar
2.javax.persistence.jar
3.mysql-connector-java-5.1.21-bin.jar
Now open hibernate perspective Goto Window > Open Perspective > Other.. as shown in below image.
Now Create Database. Here i use mysql to create database.
My Schema name is revhibernate that contains two tables
My Schema name is revhibernate that contains two tables
1. Employee
2. Company
2. Company
The image of the tables as shown below
1.Employee Table
add foreign key in employee table as shown in below image.
2.Company Table
Now again switch to hibernate then
Press right click on src folder and create new hibernate.cfg.xml file.
Add folowing properties
1.src path
2.hibernate configuration file name
3. DB type MySQL
4.select driver from drop down
5. url define port and Db connectivity path
6.username and password as per your db
7. check right and then finish.
2.hibernate configuration file name
3. DB type MySQL
4.select driver from drop down
5. url define port and Db connectivity path
6.username and password as per your db
7. check right and then finish.
Press right click on project folder and create new file in project folder hibernate.reveng.xml as shown in below image.
Perform following activity:-
1. select config
2.include only those table thats you want to generate code
3.click on refresh
4.click on finish button
2.include only those table thats you want to generate code
3.click on refresh
4.click on finish button
here is check box for require code..
please select as per your requirment.
After run this the result is here :
hbm file and bean class corresponding the db table is create......
hbm file and bean class corresponding the db table is create......