Hibernate with MySQL
If we want to use MySQL Database for Hibernate applications then we have provide the following changes.
In Hibernate Configuration File
Driver Class Name : com.mysql.jdbc.Driver Driver URL : jdbc:mysql://localhost:3306/employee DB User Name : root DB Password : ashok Dialect : org.hibernate.dialect.MySQLDialect
We must add mysql-connector-java-5.0.8-bin.jar file to class path. In Hibernate Applications, it is not suggestible to manage Configuration object and SessionFactory object in Client Application directly, because, these two objects are providing Hibernate Boot strapping. In further if we want to change boot strapping mechanisms then we have to provide changes in Client Application, it may effect our persistence operations. To avoid this type of problems we have to use a separate Utility class to prepare Configuration and SessionFactory object.