markdown [Hibernate:basic-APIs] #hibernate #sessionFactory #session #session #transaction #database

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown [Hibernate:basic-APIs] #hibernate #sessionFactory #session #session #transaction #database相关的知识,希望对你有一定的参考价值。

## SessionFactory (org.hibernate.SessionFactory)
- A thread‐safe, immutable cache of compiled mappings for a single database.
- A factory for org.hibernate.Session instances.
- A client of org.hibernate.connection.ConnectionProvider.
- Optionally maintains a second level cacheof data that is reusable between transactions at a process or cluster level.

## Session (org.hibernate.Session)
- A single‐threaded, short‐lived object representing a conversation between the application and the persistent store.
- Wraps a JDBC java.sql.Connection.
- Factory for org.hibernate.Transaction.
- Maintains a first-level cache of persistent the application's persistent objects and collections; this cache is used when navigating the object graph or looking up objects by identifier.

## Persistent objects and collections
- Short‐lived, single threaded objects containing persistent state and business function.
- These can be ordinary JavaBeans/POJOs.
- They are associated with exactly one org.hibernate.Session.
- Once the org.hibernate.Sessionis closed, they will be detached and free to use in any application layer (for example, directly as data transfer objects to and from presentation).

## Transient and detached objects and collections
- Instances of persistent classes that are not currently associated with a org.hibernate.Session. 
- They may have been instantiated by the application and not yet persisted, or they may have been instantiated by a closed org.hibernate.Session.

## Transaction (org.hibernate.Transaction)
- (Optional) A single‐threaded, short‐lived object used by the application to specify atomic units of work.
- It abstracts the application from the underlying JDBC, JTA or CORBA transaction.
- A org.hibernate.Session might span several org.hibernate.Transactions in some cases. However, transaction demarcation, either using the underlying API or org.hibernate.Transaction, is never optional.

## ConnectionProvider (org.hibernate.connection.ConnectionProvider)
- (Optional) A factory for, and pool of, JDBC connections.
- It abstracts the application from underlying javax.sql.DataSource or java.sql.DriverManager.
- It is not exposed to application, but it can be extended and/or implemented by the developer.

## TransactionFactory (org.hibernate.TransactionFactory)
- (Optional) A factory for org.hibernate.Transactioninstances.
- It is not exposed to the application, but it can be extended and/or implemented by the developer.
 
## Extension Interfaces
- Hibernate offers a range of optional extension interfaces you can implement to customize the behavior of your persistence layer. See the API documentation for details.

以上是关于markdown [Hibernate:basic-APIs] #hibernate #sessionFactory #session #session #transaction #database的主要内容,如果未能解决你的问题,请参考以下文章

Hibernate 5.2.9:@Basic(fetch = FetchType.LAZY) 不工作

Markdown: Basics (快速入门)

markdown basic_install.md

markdown basic_install.md

markdown Angular_Firebase_basic

markdown basic_install.md