What are the advantages and disadvantages of using Entitybean and JDO in Java EE

Source: Internet
Author: User
Tags connection pooling
Entity Bean:
Provides robust data persistence. The bean container handles most of the data integrity, resource management, and concurrency features, allowing developers to focus on business logic and data processing, rather than these low-level details. When using bean-managed persistence (Bean Managed persistence,bmp) entity beans, developers write persistent code and the container determines when the code executes. When using container-managed persistence (Container Managed Persistence, CMP) entity beans, the container generates persistent code and manages the persistence logic.

JDO: only provides object-oriented persistent data storage. Developers use POJO (unformatted normal Java objects, plain ordinary Java object) to mount and store persistent data.

Entity beans mainly have the following advantages:

1) standardization. The EJB specification defines a set of vendor-independent interfaces that Java EE vendors can implement to support entity beans. This standardization allows for the development of best practices and shortens the adaptation period when hiring new developers. Because the basic component architecture and design patterns are known to all, it is easy to find qualified people to implement them.
2 Container Management Services. As we discussed in the first two articles of this series, EJB container-managed services provide great benefits for dealing with enterprise functions such as security, transaction processing, connection pooling, and resource management.
3) Transparent durability. In CMP, the container can automatically manage persistent semantics. While using a BMP entity bean, the developer must write the persistence logic, and the container determines when the method defined by the developer is invoked. When using both CMP and BMP entity beans, the container determines when the state of the bean is persisted and how to ensure data integrity and concurrency with the underlying data store.
4) Transaction support. Developers have granular control over CMP transactions (containment level, transaction requirements, and the inclusion/exclusion of methods), with fine-grained control over BMP transactions, which are implemented programmatically with transaction semantics in bean code. In both cases, the container manages the transaction and determines whether the given transaction should be committed.
5) based on the component design. Entity beans are designed to contain components that are configured with deployment descriptors and can be deployed to any Java EE application Server without changing any code.

In summary, the advantage of entity beans is that they can benefit from standardization and industry best practices, simplifying some of the complexities of enterprise development
The disadvantages are:
1 design complex.
2 because of the complexity of enterprise beans and (especially) entity beans, one iteration (Design/build/test/integrate/test/deploy) can take longer than other Java persistence solutions.
3) Response time is not ideal
4 resource consumption is too high, will always consume a large number of server resources.



Compared to entity beans,
The advantages of JDO are:

1) Simple design.
2 fine-grained control, allowing developers to fully control the entire persistence process, including caching, persistence, concurrency, and synchronization.
3) coding is simple. The JDO architecture hides low-level persistence details for developers.
4 JDO does not only make Java objects persistent; it also transparently handles the persistence of the entire graph of related objects. Therefore, when an instance is persisted, any internal references it maintains to other object instances are also persisted (unless they have been declared transient). JDO also stores the complete information of the type hierarchy and implements the request based on the type (parent class and interface) rather than on the specific local type of the persistent instance.

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.