Really, why use hibernate?

Source: Internet
Author: User
Tags benchmark continue ibm db2 pack websphere application server advantage

You already have the JPA implementation you need

Recently, I answered a few forum posts, emails, instant messages, and phone calls about using Hibernate within the Ibm®websphere®application Server environment. Because people have a strong interest in this subject, I would like to introduce the information here, I hope this article will be helpful to those who have not had time to ask me personally.

Specifically, I mean using Hibernate JPA in a WebSphere application Server environment. This is also the original Hibernate programming model, which I call the Hibernate "classic". Since this classic Hibernate programming model is not part of the Java™ee 5 suite, it has little to do with this topic. This article has several iterations that describe how to take advantage of the Hibernate "classic" programming model in a WebSphere application Server environment. This use is essentially similar to any other utility framework. You can package it as a (shared) library and use it from your application, but it is not a necessary part of the entire application server runtime.

This article focuses on how to use Hibernate jpa-in a WebSphere Application server environment or, since WebSphere application server has provided an industry-leading JPA implementation, why Using Hibernate JPA?

What is JPA?

JPA is the Java Persistence API, which is the standard persistence framework, introduced for the first time in Java EE 5 as part of the EJB™3.0 specification family. To Java EE 6,JPA 2.0 developed to own a JSR. The core of JPA is a object/relational (O/R) Mapping facility, but it has evolved to encompass several other features. Because JPA is a necessary component of the Java EE Suite, its functionality is fully integrated with EJB containers and Web containers, transaction management, database connection management, and security management. Many technologies are injected into JPA creation processes, such as EJB CMP, JDO, and Hibernate. So it's not surprising that so many existing Hibernate users want to continue using this framework in the WebSphere application Server environment.

The continued use of Hibernate is a controversial and effective goal, just as it takes time and resources to get from one programming model (classic) to another (JPA). If there is not enough justification to support the investment, then it is possible to continue to use the tools that are already in effect, and this behavior may even be encouraged.

But if you are planning to migrate to JPA standards and enjoy the benefits, there are several compelling reasons to migrate from the Hibernate Classic to the WebSphere JPA solution.

WebSphere JPA Solutions and benefits

The WebSphere application Server JPA solution is built on the Apache OpenJPA project:

The WebSphere application Server V6.1 Feature Pack for EJB 3 first contains JPA and is based on OpenJPA 1.0.x service flow.

The WebSphere application Server V7 provides a complete Java EE 5 stack, including an updated JPA based on the OpenJPA 1.2.x stream.

Recently, the WebSphere application Server V7 Feature Pack for OSGi applications and Java Persistence API 2.0 was introduced, based on OpenJPA 2.0.x streaming 。

All of these software take advantage of the same binaries that can be retrieved from the OpenJPA download site, so there is a guarantee that any application written against Apache OpenJPA can be application Server in WebSphere without modification Environment to run in.

Of course, WebSphere application Server also provides a very complete, very rich JPA solution with some defined insertion points to provide features other than OpenJPA basic software.

Easy to use

The WebSphere JPA solution is fully integrated into the WebSphere application Server product. Regardless of whether your environment uses one of the feature pack solutions or the WebSphere application Server V7,JPA solution, it can be out-of-the-box, with no additional configuration or packaging required.

Because of this integrated JPA solution (see Figure 1), WebSphere application Server can provide some feature extensions to the underlying OpenJPA binaries. Some of the areas that have been enhanced include IBM db2® extensions (specifically pureQuery integration and lockout optimization), performance, configuration and management support, security support, extended tracking and log support, and national language support for message logging.

Figure 1. WebSphere JPA Architecture

WebSphere Application Server JPA allows you to install and use alternative JPA providers while the WebSphere application server is running. For example, Hibernate JPA can be used, but Hibernate JPA providers cannot obtain any WebSphere application Server extensions. In addition, the Hibernate JPA solution package is not simple. It should be noted, therefore, that although WebSphere application Server does support the use of alternative JPA providers, there are some drawbacks to this approach.

Lower support costs

The complete WebSphere JPA solution has complete IBM product services and support, which means that any problems identified will be resolved through regular support channels. Most of the members of the JPA development team are active contributors to the Apache OpenJPA project. All issues will be documented and resolved via the Apache OpenJPA project. These updates are then easily delivered as part of the regular WebSphere support process.

Another major advantage of the WebSphere JPA solution is compatibility support between different distributions. It is important to migrate from one WebSphere application Server release to another-including a complete version and Feature Pack-as simple as possible, and IBM makes every effort to make the JPA migration as easy as it can. If a new JPA or Java EE specification forces an incompatible change to the product, it typically provides documentation and "support options" to implement the behavior described above. Because of the flexible packaging architecture of OpenJPA, WebSphere Application server can replace any nonstandard OpenJPA behavior to make the WebSphere Application server experience consistent across different distributions.

If you use an alternative JPA provider, such as Hibernate JPA, the WebSphere application Server supports stopping at the defined insertion point of the alternative JPA provider. Any problems found in alternative JPA providers (such as object mapping, database interaction, performance issues, and so on) need to be addressed with the provider. This may involve using their forums to get support, or setting up an external service contract. Obviously, it's not very convenient.

Better performance

Keep in mind that performance comparisons may not be objective. Any performance benchmarking that is developed and promoted by a JPA provider-even the so-called "standalone" JPA benchmark test published to the Web-may favour a JPA provider. These types of specific JPA benchmark tests may be more fragmented if the license factor is added again.

For these and other reasons, IBM often relies on industry-standard benchmark testing. For example, Specjenterprise considers several aspects of the application server, but focuses on the persistence framework. It is estimated that the 75-80% specjenterprise benchmark test relies on the persistence layer (that is, the JPA provider). Specjenterprise 1q2010 clearly shows the leadership of WebSphere in this area, and similar results appear in 2q2010 and later versions.

IBM continues to compare WebSphere application Server JPA solutions and other solutions with simple operations (create, retrieve, update, and delete), run industry benchmark tests, and other methods. IBM has measured many variants to ensure that the WebSphere JPA solution continues to remain a performance leader and maximizes the experience and overall benefits of WebSphere application Server.

Conclusion

This article mainly clarifies that sticking to a WebSphere JPA solution rather than migrating to Hibernate JPA (or any other JPA provider) is a wise choice in business, development, and everything else. Ease of use, lower cost, better performance, and seamless experience not only maximize the benefits you get from WebSphere application Server, but also help maximize your development effort.

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.