<hibernate-configuration> <session-factory></span></span><!-- Related to the connection START --> <property name="connection.driver_class">Driver Class Name </property> <property name="connection.url">URL </property> <property name="connection.user">user </property> <property name="connection.password">password</property> <!-- Related to the connection END --><!-- Related to hibernate properties START --> <property name="show_sql">true/false</property> <property name="dialet">Database dialet class</property> <property name="hbm2ddl.auto">create/update or what ever</property> <!-- Related to hibernate properties END--> <!-- Related to mapping START--> <mapping resource="hbm file 1 name .xml" / > <mapping resource="hbm file 2 name .xml" / > <!-- Related to the mapping END --> </session-factory> </hibernate-configuration>
Properties | Description |
---|---|
hibernate.connection.driver_class | The JDBC driver class. |
hibernate.dialect | This property makes Hibernate generate the suitable SQL for the picked database. |
hibernate.connection.url | The JDBC URL to the database instance. |
hibernate.connection.username | The database username. |
hibernate.connection.password | The database password. |
hibernate.connection.pool_size | Limits the number of connections waiting in the Hibernate database connection pool. |
hibernate.connection.autocommit | Allows autocommit mode to be used for the JDBC connection. |
The configuration file will consist of connection properties, hibernate properties, mapping file name will consist of all the related class names. Dialect classes are used to convert HQL statements to database specific statements. To connect any database with hibernate, We need to specify the database Dialect class in hibernate. cfg. xml. If a show_sql value is true, generated the SQL statements in a console.