Home  >  Article  >  Web Front-end  >  Hibernate configuration

Hibernate configuration

php中世界最好的语言
php中世界最好的语言Original
2018-03-07 17:01:471063browse

This time I will bring you the configuration of Hibernate. What are the precautions for Hibernate configuration? The following is a practical case, let's take a look.

Database:

Mysql

Configuration file nameHibernate.cfg.xml

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"><hibernate-configuration><!-- SessionFactory -->
    <session-factory>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/database</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="hibernate.connection.username">username</property>
        <property name="hibernate.connection.password">password</property>
        <property name="show_sql">true</property>
        <property name="hbm2ddl.auto">update</property>
        <mapping resource="com/troyforever/mvc/bean/Example.hbm.xml" />
    </session-factory></hibernate-configuration>

I believe you have mastered it after reading the case in this article For more exciting methods, please pay attention to php Chinese website

Other related articles!

Related reading:

Web.xml configuration

Spring’s MVC configuration

Hibernate mapping file detailed explanation

Spring configuration

The above is the detailed content of Hibernate configuration. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Spring configurationNext article:Spring configuration