Last month's "Explorer" column introduced J2EE technology for Data persistence: entity beans, JDBC, and Java Data Objects (Java Data Objects, JDO ). This month, Enterprise Java expert Kyle Gabhart did not discuss more mature JDBC and EJB technologies, but mainly introduced JDO. Although this technology is not mature compared with other technologies, you will find that JDO has some unique advantages.
Application components should implement requests for enterprise services. To implement these requests, application components often have to change the state of the underlying data storage. These changes do not undermine the integrity of persistent data storage. (In the first article on data persistence, we defined persistent data storage as an independent data resource library, even when the server crashes or the network fails, this data resource library can also protect the data in it .) To ensure durability, application components must be able to handle concurrency, connection management, data integrity, and synchronization. All three data management technologies of J2EE can handle these functions for developers, but each technology has its own processing method.
Last month, we discussed the advantages and disadvantages of entity beans and JDBC. This month, we will see how Java Data Objects are combined with stateless session beans and how the solution compares with standard Entity bean applications. Since JDO is still a fairly new technology (the latest J2EE persistence solution), we will first outline its working principles.
JDO overview
For a long time, the relationship between Java applications and persistent data management has never been easy to process. Many persistence mechanisms store data in relational rather than object-oriented methods. That is, data is stored in a table consisting of records containing fields, rather than self-contained objects (these objects have internal data and reference to other objects, other objects also have internal data and references ). Converting an object-oriented representation into a relational representation is always troublesome, error-prone, and reduces application performance. Until recently, a few non-relational persistence mechanisms (such as SQL BLOB and Java serialization) were also very troublesome to use. Most persistence mechanisms allow developers to handle durability, or use non-Java languages (such as SQL) to interact with backend data storage.
The advantage of JDO is that it is very simple. Developers use Java to persistently store object instances and retrieve instances from memory. The processing logic, synchronization, and failover are all handled transparently. Developers do not need to use an inconvenient serialization mechanism provided by SQL or Java. They only need to use POJO (common Java objects in no format, use the JDO interface to pass object references to the memory and retrieve object references from the memory.
J2EE persistence technology
The Entity bean provides robust data persistence. Bean containers process the vast majority of data integrity, resource management, and concurrency functions, allowing developers to focus on business logic and data processing without having to consider these low-level details. Using the Bean Managed Persistence (BMP) Entity Bean, developers write the Persistence code, but the container determines when to execute the code. Use the Container-Managed Persistence (CMP) Entity bean to generate the Persistence code and manage the Persistence logic.
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