================================================
instal hibernate plugin for eclipse
http://www.mkyong.com/hibernate/how-to-install-hibernate-tools-in-eclipse-ide/
Create Hibernate Configuration Engineering file
----------------------------------------------------------------
Right click on hibernate configuration folder -> New -> Others
Select Hibernate -> Hibernate configuration file (.cfg.xml)
Click Next and give the hibernate configuration file name (hibernate1.cfg.xml)
Click Next and provide DB connection details and check Create Console configuration .
Session factory name: dataSource
Database dialect: MySQL (InnoDB)
Driver class: com.mysql.jdbc.Driver
Connection URL: jdbc:mysql://localhost/ezr_db_2_0
or jdbc:mysql://192.168.10.214/ezr_db_2_0 (jdbc:mysql://
User name: root
Password: root
Click Next
Select Annotation radio button and click Finish.
Create Hibernate Reverse Engineering file
-------------------------------------------------------------
Right click on hibernate configuration folder -> New -> Others
Select Hibernate -> Hibernate Reverse Engineering file (reveng.xml)
Click Next and give the hibernate reverse engineering file name (hibernate.reveng.xml)
Select hibernate folder in the project (easyretail_v2_0 easyretail_v2_0 [192.168.10.192]/conf/hibernate)
Click Next .
Select Console Configuration (easyretail_v2_0(1)) and click Refresh to get the database table details information.
Select all table and click include button and Click on Finish.
Create temporary domain class file store package
Right click src -> New -> Package
Provide package name (temp.easyretail.domain ) and click Finish.
Run hibernate reverse engineering file to generate domain
------------------------------------------------------------------------
Select New Connection
Click OK if bellow message come.
Create New connection Hibernate Code Generation -> New
Provide Name (easyretail_2_0) , Select Console configuration (easyretail_2_0(1))
Select output directory click on Browse button and select output directory for the domain class and Click OK.
Click on Apply .
Click on Expoters tab and checked Use Java 5 syntax, Generate EJB3 anonotation and Domain class
Click Apply button.
Click on Common tab and checked Hibernate Code Generation
Click Apply button
No comments:
Post a Comment