1 <!--declaration of an XML file -2 <?XML version= "1.0" encoding= "Utf-8"?>3 <!--the declaration of the hibernate DTD file -4 <!DOCTYPE hibernate-mapping Public5 "-//hibernate/hibernate Mapping DTD 3.0//en"6 "Http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">7 <!--the root node of the mapping file -8 <hibernate-mapping>9 <!--Ten start of Object Relational mapping: The class element represents the mapping of a table in a class and database. One The name attribute specifies the Java fully qualified name of the persisted class (or interface); A The Table property specifies the corresponding database table name to be mapped - - - <classname= "Org.qiujy.bean.User"Table= "User"> the <!-- - The object identifier (OID) of the persisted class object and the mapping association of the table's primary key: - The Name property specifies the name of the property in the class as the OID; - the name of the primary key field in the Column property sheet; + The Type property specifies the types of mappings for Hibernate - - + <IDname= "id"column= "id"type= "int"> A <!--specify the object identifier Generator: Class property specifies the class name of the generator - at <Generatorclass= "Native"/> - </ID> - <!-- - mappings for normal properties: - Name Property: The names of the properties, beginning with lowercase letters; - Column property: The corresponding database field name in Type Property: Specifies the type of mapping for Hibernate - - to < Propertyname= "Name"column= "Name"type= "string"/> + < Propertyname= "Age"column= "Age"type= "int"/> - </class> the </hibernate-mapping>
Hibernate mapping File parsing