Chapter 1 Introduction
Basic Content: preview hibernate.
Chapter 2 Architecture
This chapter mainly describes the structure of hibernate in the entire system.
1. The status of a PO (Persistent Object:
Transient (transient): no value for ID and no corresponding row for database
Persistent (persistence): The ID has a value, the database may have corresponding rows, and hibernate ensures that the Po corresponds to the memory.
Detached (managed): The ID has a value, and the database may have corresponding rows.
Chapter 3 Configuration
Explains the configuration file ing file and how to read the configuration from hibernate.
Configuration method:
1. New configuration (). addclass (user. Class). addproperties ("hibernate. dialect", org. hibernate. dialect. mysqlinnodbdialect) when obtaining sessionfactory)
2. Pass a java. util. properties to configuration
3. Place hibernate. properties in the root directory.
4. Use hibernate. cfg. XML to configure
For all required properties in the configuration, see the document (all attribute tables are available), such as Hibernate. hbm2dll. Auto.
Note: read an xml configuration named sessionfactory Sf = new configuration (). Configure ("XXXX. cfg. xml"). buildsessionfactory ();
Chapter 4 persistence class
Persistence objects can be pojo classes or tree-like XML or maps in dom4j. Usually we use pojo classes (this is the concept of dynamic domain models ). (Which model is configured by default_entity_mode)
Chapter 5 basic ORM for Object/Relational Database ing
Ing File Format
The ing file can be automatically generated by XDoclet.
[Note] the where ing attribute has a where attribute which is very useful, that is, the @ where () sentence in the comment. The function is to add this condition to the SQL sentence that captures this class.
[The following is a ing File Attribute Table, which can be applied in Annotation]
1. External tag configuration (total configuration ):
2. Configure the object class (defined before the class name ):
1,Generator generator type:
Increment: auto-incrementing for long, Int, and short, not for cluster.
Identity: generate a policy using the built-in generator of a general database. [not supported by Oracle ].
Sequence: generate a primary key using sequence. [Oracle Support ].
Native: automatically selects identity and Sequence Based on the underlying database capabilities to generate primary keys.
Assigned: Before saving (), the program manually specifies a primary key value. [This is the Default policy of generator]
For more information, see 5.1.4.1.
Chapter 6
Basic Content, basic configuration and ing file of hibernate. See the hibernate configuration file template.
Chapter 7
Basic Content, basic configuration and ing file of hibernate. See the hibernate configuration file template.
Chapter 8
Basic Content, basic configuration and ing file of hibernate. See the hibernate configuration file template.
Chapter 9
Basic Content, basic configuration and ing file of hibernate. See the hibernate configuration file template.
Chapter 10
Basic Content, basic configuration and ing file of hibernate. See the hibernate configuration file template.
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2