Thursday, December 6, 2012

Hibernate Reverse Engineering

Hibernate Reverse Engineering using Eclipse + plugin

Eclipse helios hibernate plugins URL

 Latest Stable Release - http://download.jboss.org/jbosstools/updates/stable/

Steps : filter by hibernate and select all hibernate tools , say next.

After installing the plugin cross check in  by selecting the new project -> others

Add caption


Steps to generate the Entities or Hbm files.

Step1 : create the normal java project and then right click on project -> new project - > others-> select the console configuration
Add this file hibernate.cfg.xml in classpath of the project

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.session_factory_name">MySessionFactory</property>
        <property name="hibernate.connection.driver_class">
            com.mysql.jdbc.Driver</property>
        <property name="current_session_context_class">thread</property>
        <property name="hibernate.connection.url">jdbc:mysql://192.168.42.40:3306/portal</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.connection.password">password</property>
        <property name="hibernate.connection.pool_size">10</property>
        <property name="show_sql">true</property>
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="hibernate.hbm2ddl.auto">update</property>
        <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
       
        <!-- Mapping files -->
    </session-factory>
</hibernate-configuration>





Click next

By default configuration file will be selected

For Database connection select has new

Select a db u required and click next

after that click finish

Reverse engineering step.

No comments:

Post a Comment