Hibernate

PROJECT STRUCTURE

  1. Usually maven project is used(why not normal?-can be used need to provide needed jars) add dependencies in POM( mysql, hibernate).
  2. Add configuration related to Hibernate in config file(src/main/resources)

<hibernate-configuration>

                <session-factory>

                                <property name=“hibernate.connection.autocommit”>false</property>

                                <property name=“hibernate.connection.driver_class”>com.mysql.jdbc.Driver</property>

                                <property name=“hibernate.connection.password”>root</property>

                                <property name=“hibernate.connection.url”>jdbc:mysql://localhost:3306/test</property>

                                <property name=“hibernate.connection.username”>root</property>

                                <property name=“hibernate.current_session_context_class”>thread</property>

                                <property name=“hibernate.connection.pool_size”>2</property>

                                <property name=“hibernate.dialect”>org.hibernate.dialect.MySQL5Dialect</property>

                                <property name=“hibernate.show_sql”>true</property>

                                <property name=“hibernate.format_sql”>true</property>

                                <property name=“hibernate.hbm2ddl.auto”>update</property>

                                <mapping class=“pojos.User”/>

                </session-factory>

</hibernate-configuration>       

Discritpion of Tags:

Published by

Unknown's avatar

sevanand yadav

software engineer working as web developer having specialization in spring MVC with mysql,hibernate

Leave a comment