There are mainly six important tags for hibernate configuration file. Hibernate configuration file naming convension is generally hibernate.cfg.xml and it is generally placed in the classpath. This can also be configured in the file. If both hibernate.cfg.xml and are found in the classpath then hibernate.cfg.xml overrides file.
The important tags are as follows:


<?xml versi encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"


JDBC Configuration

<property name="connection.driver_class">db_driver(com.mysql.jdbc.Driver)</property>
<property name="connection.url">db_connection_url(jdbc:mysql://localhost:3306)/db_name</property>
<property name="connection.username">db_username</property>
<property name="connection.password">db_password</property>


SQL variant generation

<property name="dialect">db_dialect(org.hibernate.dialect.MySQLDialect)</property>


Connection pool size

<property name="hibernate.connection.pool_size">10</property>


Automatic generation of database schema

<property name="">create-drop</property>


Mapping files

<mapping resource="com/garnaik/classified/pojo/Department.hbm.xml"/>
<mapping resource="com/garnaik/classified/pojo/Employee.hbm.xml"/>


Thanks for your patience. If you have any question please write to me.


I am a professional Web developer, Enterprise Application developer, Software Engineer and Blogger. Connect me on Roy Tutorials | TwitterFacebook Google PlusLinkedin | Reddit

Leave a Reply

Your email address will not be published. Required fields are marked *