Now let us create hibernate.cfg.xml configuration file to define database related parameters.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration SYSTEM "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <propertyname="hibernate.dialect"> org.hibernate.dialect.MySQLDialect </property> <propertyname="hibernate.connection.driver_class"> com.mysql.jdbc.Driver </property> <!-- Assume students is the database name --> <propertyname="hibernate.connection.url"> jdbc:mysql://localhost/test </property> <propertyname="hibernate.connection.username"> root </property> <propertyname="hibernate.connection.password"> cohondob </property> </session-factory> </hibernate-configuration> |