If you do not want to use the default hibernate.cfg.xml file as a configuration file, we can also specify the configuration file name:
File file = new File ( "C: \ \ myhibernate.xml");
Configuration config = new Configuration (). Configure (file);

<class
        name="ClassName"                             
        table="tableName"                            
        discriminator-value="discriminator_value"    
        mutable="true|false"                         
        schema="owner"                               
        proxy="ProxyInterface"                       
        dynamic-update="true|false"                  
        dynamic-insert="true|false"                  
        select-before-update="true|false"            
        polymorphism="implicit|explicit"             
        where="arbitrary sql where condition"         (11)
        persister="PersisterClass"                    (12)
        batch-size="N"                                (13)
        optimistic-lock="none|version|dirty|all"      (14)
        lazy="true|false"                             (15)
/>



select-before-update (optional, defaults to false): designated Hibernate unless indeed been modified to identify the object, and will not implement the SQL UPDATE operation. At specific occasions (in fact, it will only happen in a temporary object to a new session in the go, the implementation of update () time), This shows that Hibernate will perform an UPDATE before extra SQL SELECT operation, to decide whether it should for UPDATE.
The use of select-before-update will usually reduce the performance. When is the trigger to prevent unnecessary database update trigger, which has been useful.

(11) where (optional) specify an additional SQLWHERE conditions at crawl this type of object will always increase in this condition.

(15) lazy (delayed) (optional): If the setting lazy = "true", is set up this type his name as a proxy interface forms an equivalent shortcut.

polymorphism (many-shaped, multi-state) (optional, defaults to implicit (implicit)): defined as implicit or explicit query polymorphism.

Implicit (implicit) in many states means that, if the query is give any super-categories, such implementation of the interface or the class name, will return to this kind of example; give if the query is the subclass of name, will be back subclass example. Explicit (explicit) in many states means that only in the query are kind of give a clear name back when this kind of example; simultaneously only when the definition in this <class> as <subclass> or < joined-subclass> emerging subclass will likely return. In most cases, the default polymorphism = "implicit" are appropriate. Explicit in many states there are two different classes are mapped to a table with the time very useful. (Allowing a "light" class contains only part of table fields).

<id
        name="propertyName"                     
        type="typename"                         
        column="column_name"                    
        unsaved-value="any|none|null|id_value"  
        access="field|property|ClassName">      

        <generator/>
</id>



If the name property does not exist, would not consider this type of marking property.

unsaved-value property is very important! If you like the logo for the property instead of the default of null, you should specify the correct default values.

Generator:
increment (increase)
For long, short or int that uniquely identifies the type of generation. Only in the absence of other processes to insert a table with data to use. Do not use at the next cluster.
Since different mysql database growth. This increment is hibernate inside a cumulative counter, but the accumulation is limited, there will be repeat, does not apply to the cluster.

identity
Means the growth of the primary key generation methods. Of DB2, MySQL, MS SQL Server, Sybase and HypersonicSQL built to provide support for identity columns. Identifier back are long, short or int type.

sequence (sequence)
In DB2, PostgreSQL, Oracle, SAP DB, McKoi the use of sequence (sequence), and in the use of Interbase Generator (generator). Identifier back are long, short or int type.

hilo (low bit)
Using a hi / lo algorithm to efficiently generate the long, short or int type of identifier. Given a table and fields (the default are separately hibernate_unique_key and are next) as a source of high worth. Hi / lo algorithm generates identifiers only in a specific database are unique. In the use of JTA connection or access to users to provide their own connections, do not use this generator.
Primary key has two parts. High are obtained from the database through. Have in the database tables used to protect the high value.
Table hibernate_unique_key:
+---------+
| Next_hi |
+---------+
| 0 |
+---------+
Are low at cumulative internal hibernate.

seqhilo (using the sequence of high and low places)
Using a hi / lo algorithm to efficiently generate the long, short or int type of identifier, given a database sequence (sequence) by name.

uuid.hex
With a 128-bit string of the UUID algorithm to generate the type of identifier. Only at a network (using the IP address). UUID is encoded as a 32-bit 16-digit hexadecimal string. a

uuid.string
Use the same UUID algorithm. UUID is encoded as a 16 character long random string composed of ASCII characters. Can not use PostgreSQL database

Compared with the high and low places, do not need to access the database to obtain the primary key, can be internally generated by the hibernate, but also to ensure that any two primary key unique. Inserted at the time do not need access to the database, insert a high performance, the use of insert frequent situation. And portability of this approach is better, because there is no relationship between it and the database, not data bound. But it is the primary key in accordance with the inquiry, because of the string, the efficiency as high integers.

native (local)
According to the underlying database's ability to select identity, sequence or hilo one. Database, mysql will select for the use of identity, the oracle will select the use of sequence. If these two do not support, then the use of high and low places.

foreign (external references)
The use of another associated object identifier. And the United <one-to-one> used together.

Identifier (discriminator)

<discriminator
column = "discriminator_column"
type = "discriminator_type"
force = "true | false"
/>

At "an object corresponds to a table inheritance tree" strategy, <discriminator> elements are necessary, it stated that the table identifier field. Identifier field contains the symbol value for this durable layer should be the creation of a specific line of examples of what sub-category. Can only use the following restrictions on some types: string, character, integer, byte, short, boolean, yes_no, true_false.

typename may be the following:

Hibernate basic types (such as: integer, string, character, date, timestamp, float, binary, serializable, object, blob).

A Java class name, this category belong to a default basic type (such as: int, float, char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob).

A subclass of PersistentEnum name. (For instance:. Eg.Color).

A sequence of Java class names.

A custom type of category names. (For instance: com.illflow.type.MyCustomType).

If you do not specify the type, Hibernarte will use reflection to get the name of the property, in order to guess the correct Hibernate type. Hibernate on the property reader (getter method) Return the type of explanation, in accordance with the rules of the order of 2,3,4. However, this is not enough. In some cases you still need to type property. (For instance, in order to distinguish between Hibernate.DATE and Hibernate.TIMESTAMP, or in order to specify a custom type.)

access to property Hibernate allows you to control how the property at run-time visit. By default, Hibernate will use the property get / set methods right. If you specify access = "field", Hibernate will ignore the get / set methods on a direct use of reflection to access the member variables. You can also specify your own strategy, which required implementation yourself net.sf.hibernate.property.PropertyAccessor interface, and then set up access at a custom strategy for your category name.

property-ref: (optional) Specify the type of a related property, the property will be and the corresponding foreign key. If not specified, will use other types of primary key association.