Persistent layer framework Hibernate related concepts

Source: Internet
Author: User

Hibernate is a fully automatic durable layer framework (framework);

1. Function: Keep the active object in memory in the relational database forever.

2.o/r/m principle: O-->object object, R---> Relational relational database, M--->mapping map

A solution proposed to address the mismatch between the objects in the application and the tables in the relational database.

3. How to get the session factory in the new version hibernate4 to create a connection object

Configuration cfg = new configuration (). Configure ("Config/hibernate.cfg.xml");

Get the Session factory (Hibernate3), now obsolete
Sessionfactory SF = Cfg.buildsessionfactory ();

Create a service registry, which is now the method of getting the session factory, there are two steps, one: Create a service registry, two: Create a session factory.
Serviceregistry Serviceregistry =
New Serviceregistrybuilder ()
. Applysettings (Cfg.getproperties ())
. Buildserviceregistry ();

Sessionfactory SF = cfg.buildsessionfactory (serviceregistry);

Get session (essentially a connection-connected package)
Session session = Sf.opensession ();

4. What is JDBC?

All in English: Java Data Base Connectivity, which is Java's connection to the database. is a Java API (Java application Programming Interface application programming Interface) for executing SQL statements.

5. What are the problems with using JDBC in hibernate?

First: JDBC cannot cross the database platform (we use dialect dialect to solve this problem in hibernate);

Second: Difficult to maintain, because the SQL statement is written by the programmer himself in DAO, modify the need to find the source code to modify.

6. What is PO?

All in English: persistent object persisted.

7. What is Pojo?

All English: Plain old Java object. Used to represent ordinary Java objects, which do not contain business logic or persistent logic, etc., it can only load data, as a carrier of data storage, but not with the business logic processing power.

What are the advantages of 8.ORM?

One: increase productivity;

Second: maintainability;

Three: Better performance (lazy loading, optimized caching, etc.).

9. What is metadata (meta data)?

Metadata is the data that describes the data, both properties and XML files are a representation of metadata.

What are the 10.ORM frames?

One: JDO; II: MyBatis three: Hibernate.

Related Article

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.