In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what technologies does JPA include". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "what aspects of JPA technology" it!
Preface
JPA was developed by the EJB 3.0 software expert group as part of the JSR-220 implementation. But it's not limited to EJB 3.0. you can use it in Web applications or even desktop applications. The purpose of JPA is to provide persistence standard specification for POJO. It can be seen that after years of practical exploration, the concept of being able to run independently from the container and facilitate development and testing has been deeply rooted in the hearts of the people. Currently, Hibernate 3.2, TopLink 10.1.3 and OpenJPA all provide the implementation of JPA
Content
JPA (Java Persistence API) is the Java persistence specification officially released by SUN. It provides Java developers with an object / association mapping tool to manage relational data in Java applications. The main purpose of its emergence is to simplify the existing persistence development work and integrate ORM technology, and put an end to the current situation of separate ORM frameworks such as Hibernate,TopLink,JDO. It is worth noting that JPA is developed on the basis of fully absorbing the existing ORM frameworks such as Hibernate,TopLink,JDO, and has the advantages of easy to use, strong scalability and so on. From the response of the development community, JPA manual great support and praise, including Spring and EJB3.0 development team, looking at the next few years of technology trends, JPA as a standardiser in the field of ORM should not be difficult to achieve.
JPA includes the following three technologies
* ORM mapping metadata
JPA supports two forms of metadata, XML and JDK5.0 annotations, which describe the mapping between objects and tables, according to which the framework persists entity objects into database tables.
* Java persists API
Used to manipulate entity objects, perform CRUD operations, the framework does everything for us in the background, developers can be freed from the tedious JDBC and SQL code.
* query language (JPQL)
This is a very important aspect of persistence operation, which queries data through object-oriented rather than database-oriented query language to avoid tight coupling of SQL statements of the program.
Advantages of JPA
1 standardization
JPA is one of the Java EE standards issued by JCP, so any framework that claims to conform to the JPA standard follows the same architecture and provides the same access to API, which ensures that enterprise applications developed based on JPA can run under different JPA frameworks with a small amount of modification.
2 support for container-level features
JPA framework supports large data sets, transactions, concurrency and other container-level transactions, which makes JPA beyond the limitations of simple persistence framework and play a greater role in enterprise applications.
3 easy to use and easy to integrate
One of the main goals of JPA is to provide a simpler programming model: creating entities under the JPA framework is as simple as creating Java classes, without any constraints and restrictions, and only needs to be annotated with javax.persistence.Entity; the framework and interface of JPA are also very simple, without too many special rules and design pattern requirements, developers can easily grasp. JPA is designed based on non-intrusive principles, so it can be easily integrated with other frameworks or containers.
4 is comparable to the query ability of JDBC
The query language of JPA is object-oriented rather than database-oriented. It constructs query statements with object-oriented natural syntax and can be regarded as the equivalent of Hibernate HQL. JPA defines a unique JPQL (Java Persistence Query Language). JPQL is an extension of EJB QL, which is a query language for entities. It operates on entities rather than tables in relational databases, and can support batch updates and modifications, JOIN, GROUP BY, HAVING and other advanced query features that usually only SQL can provide, and even support subqueries.
5 support advanced object-oriented features
JPA supports advanced object-oriented features, such as inheritance between classes, polymorphism and complex relationships between classes, which allows developers to maximize the use of object-oriented models to design enterprise applications without having to deal with the persistence of these features in relational databases.
Tip:
JPA is not a new ORM framework, its emergence is only used to standardize the existing ORM technology, it can not replace the existing ORM framework such as Hibernate,TopLink. On the contrary, when developing with JPA, we will still use these ORM frameworks, but the applications that come out at this time are no longer dependent on a persistence vendor. The application can be run in any JPA environment without modifying the code, which can really achieve low-coupling, extensible program design. To put it simply, what JPA does is what Hibernate does, and their functions are the same. However, JPA is only a set of specifications, not a set of products. Hibernate is already a set of products.
The main purpose of JPA is to simplify the existing persistent development work and integrate ORM technology, and put an end to the current situation of separate ORM frameworks such as Hibernate,Toplink,JDO. The Hibernate we learned before, in fact, we are facing the development of Hibernate's API. What's wrong with this? we are closely coupled with Hibernate. Without Hibernate, we can't use our applications in other ORM frameworks. With JPA, your application can run in persistent products that implement the JPA specification (such as Hibernate,TopLink,JDO)
JPA technology is the inevitable trend of future development. If we want to adopt ORM technology in the future, we will not face Hibernate programming, not TopLink programming, but JPA standard programming. That is to say, after a few years, our applications will rarely program in the face of Hibernate API. This is why, just like we used to access the database, assuming that there is no JDBC technology. We can only use the API provided by various database manufacturers for database links with each database link. Since we have JDBC, we no longer need to link to the database provided by the API provided by database manufacturers, but can directly use JDBC this set of specifications to connect with each database. At present, the relationship between JPA and Hibernate,TopLink is the same. JPA, like JDBC, provides a general tool to access various ORM implementation products. Through JPA technology, we only need to face its standard programming, and the compiled applications can be applied to various persistence products (including Hibernate and TopLink), which means that the underlying products are no longer important to me.
Suppliers of JPA
One of the goals of JPA is to develop an API that can be implemented by many vendors, and developers can code to implement the API instead of using a proprietary vendor-specific API. So developers only need to use vendor-specific API to get the functionality that the JPA specification does not address but is needed in the application. Use JPA API as much as possible, but use vendor-specific API when you need functionality that the vendor exposes but is not provided in the specification.
1.Hibernate
2.Spring
3.OpenJPA
4. Other
Currently supported implementations include Toplink, Hibernate Entitymanager and so on. TopLink used to charge a fee, but now it's open source. Although OpenJPA is free, it needs to be strengthened in terms of function, performance, popularity and so on.
At this point, I believe you have a deeper understanding of "JPA includes what aspects of technology", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.