Learn appetizer persistence framework

Introduction: First persistence framework are commonly used. I feel familiar and unfamiliar. I would like to describe in their own words through persistence framework. I will analyze the same persistence layer framework concept, and different implementations in this article. hope this helps.

 Access from the very beginning to learn JDBC database connection is established ourselves, to write their own sql statement and then execute, nobody wrote slowly, and too much trouble.

 Then it was suggested that such an idea, can not be used in the form of access to the object to access the database, which appeared in the frame, good frame package sql statement, we are in the form of configuration to use the framework to achieve the target in the form of the operation to the operation of the database purpose.

SNAKE

 The idea is to ORM (object-relational mapping), popular terms, it is to establish the mapping entity classes and database tables inside. We later using the persistence framework, we only need to write a certain format, we can achieve our purpose. Since you want to manipulate the data in the form of operation of the object, that object is the entity classes myself, entity classes inside the field names and the database is supposed to be inside the same, so called one mapping. Framework where we can write more than the same name, but through configuration or in the form of notes, so that means there are two this is a different understanding of field names.

  I learned persistence framework that hibernate, mybatis, there jpa. In fact, they are the point around which to use. So learning is much the same. As mentioned specific framework, we are to talk about, do not say it, I feel that they are not familiar with this framework. We are just learning framework, to see what to learn, to think big head, always feel a lot of things to learn, and when in use, little attention will be wrong. In fact, change a way of thinking, we should simplify the problem, the same thing. Like mentioned upside-called persistence layer it is to operate the database, no matter what, no matter what persistence framework is to operate the database, otherwise it is not also called persistence framework. hibernate is fully automated persistence framework, popular terms that you do not have to write sql statement, the framework do good in the end, have to help you write. Sought after by others, it is to help people save energy. Originally write sql to operate the database, not used now. But with the changing business scenario, sql is to be optimized, we want to write sql, because we ourselves can write sql optimization, to achieve a more efficient purposes. Sql optimization does not understand the meaning of this article to see me

( What is sql optimization, why should sql optimization ), so as to be encapsulated hibernate too dead, so originally sought after by others but unpopular, meaning that you do too much. Like the minister to help the emperor made all the decisions, one day, the emperor thought: Damn, the emperor you do it, what are you decision, I have no freedom. So mybits popular, he is a clever courtiers, and some things he could do, but he does not do, to do the emperor, feel free to let the emperor, the emperor so that there is room to play. So today is the popular semi-automatic persistence framework Mybatis, it put sql statement you want to optimize to write your own.

The same thing, where to go?

  orm knowledge of an idea, first of all think of database operations is still not open around the connection to the database, it is still not open around the sql statement. Even if you operate in the form of database objects, but the final framework or operating the sql. As for how the framework can not afford the operation, interested to see the source code. Just want to learn to use, first learn to use it. Persistence framework, that is, people good package to meet your requirements, in the form of an object database operation.

  Think framework to learn and use what we have done?

  Frame someone else to write, and you want to use, on the introduction of others written jar, called the ride environment . The others (jar package) come on, you can let others help you do things.

  Do you want to form ORM, it would have entity classes, and database tables. Then you reuse the configuration of the form or in the form of notes to make them even more understanding. hibernate typically formed by mapping between the form of the profile, support annotations. mybatis general comments. Notes more popular now, because annotations to facilitate that.

  Top mentioned, it is not open around the database connection, so even with the framework, you have to tell the framework where you even databases. This is called the configuration data source. Whether or hibernate mybatis must be configured. Even if you are immortal, trying to help me do things I do not tell you to let you do what you can not do this, is the truth. As for the specific configuration of how this is to use the details of the framework.

   More than one database table operations sometimes we operate, this is called is associated with the query. We just need to learn how frameworks are implemented, how to use enough.

   The remaining thing is to additions and deletions to change search the database, we are only different learning framework calls the method requires it.

  Else really gone. 

 hibernate and Mybatis not the same place

In fact, when we learn the framework, a framework is the first school, after learning framework similar time, look different, look different. Just like the top of what I have written about, you may write incomplete. The rest is not the same place. Top also mentioned, Mybatis to write sql statement. Specifically how to use what we need to learn in the framework of the.

 

 

Guess you like

Origin blog.csdn.net/star1210644725/article/details/93127855