Hibernate.cfg.xml

Source: Internet
Author: User

Hibernate.cfg.xml

<?XML version= "1.0" encoding= "UTF-8"?><!DOCTYPE hibernate-configuration Public "-//hibernate/hibernate configuration DTD 3.0//en" "Http://www.hi Bernate.org/dtd/hibernate-configuration-3.0.dtd "><hibernate-configuration>    <session-factory>    < Propertyname= "Connection.username">Root</ Property>        < Propertyname= "Connection.password">Xxx</ Property>        < Propertyname= "Connection.driver_class">Com.mysql.jdbc.Driver</ Property>        < Propertyname= "Connection.url">Jdbc:mysql://localhost:3306/hibernate_demo</ Property><!--Select Database dialect -        < Propertyname= "dialect">Org.hibernate.dialect.MySQLDialect</ Property><!--whether to output SQL statements in the console -        < Propertyname= "Show_sql">True</ Property>        < Propertyname= "Format_sql">True</ Property><!--Update for updating database tables, common create: If the database exists, the table is first removed and rebuilt -        < Propertyname= "Hbm2ddl.auto">Update</ Property>        <MappingResource= "Students.hbm.xml" />    </session-factory></hibernate-configuration>

Students.hbm.xml

<?XML version= "1.0"?><!DOCTYPE hibernate-mapping Public "-//hibernate/hibernate mapping DTD 3.0//en" "http://hibernate.sourceforge.net/ Hibernate-mapping-3.0.dtd "><!--Generated 2017-7-10 22:35:01 by Hibernate Tools 3.5.0.Final -<hibernate-mapping><!--class name is Package.classname -    <classname= "Xml_onetomany." Students "Table= "STUDENTS">        <IDname= "Sid"type= "int">            <columnname= "SID" /><!--assigned: When initializing the object, the SID should be assigned manually, otherwise int defaults to 0, other type error; Native: automatic growth, different meanings for different databases -            <Generatorclass= "Assigned" />        </ID>        < Propertyname= "Name"type= "Java.lang.String">            <columnname= "NAME" />        </ Property>        < Propertyname= "Gender"type= "Java.lang.String">            <columnname= "GENDER" />        </ Property>        < Propertyname= "Address"type= "Java.lang.String">            <columnname= "ADDRESS" />        </ Property>    </class></hibernate-mapping>

Hibernate.cfg.xml

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.