![]() ![]() When it comes to the rich set of object associations like one-to-one, one-to-many, and many-to-many, databases fall flat, as they cannot support all types of relationships. Inheritance is the fundamental object-oriented programming principle without which object associations would be impossible to design. The existence of these two software technologies is a must for most real-world applications in spite of the so-called “object-relational impedance mismatch.” We will discuss the mismatch in the next chapter in detail, but to give you an introduction, I’ll explain its main points here: How can we persist an object graph to a database?Įnterprises employ object-oriented languages (such as Java) as their programming platforms and relational databases (such as Oracle, MySQL, Sybase, etc.) for data storage. There are a plethora of database vendors (such as Oracle, MySQL, DB2, JavaDB, and others) with a lengthy list of bells and whistles. To save the data, we need durable storage spaces called databases. So, we know now that persisting the objects (their state is the data that we need to persist) is a fundamental requirement for most real-world applications. The data that’s been persisted by our application will outlive the application itself-for example, we may have moved away from online to phone banking, but the data created by our bank application should still be visible or available if required. In the context of this bank application, by persistent data I mean the customer, address, account, and other domain objects that we may have modeled in our design. This means, in order to be durable, the application data must be persisted to a permanent storage space. We expect the bank to keep a safe copy of our accounts, personal details, preferences, and transactions. Say we are designing an online banking system. We will compare and contrast both of these technologies and learn how Hibernate achieves object-relational-model persistence with ease and comfort. We will explore the technologies and tools, such as JDBC and Hibernate, that assist us in facing this challenge. This chapter sets the tone for our Hibernate discussion by first looking at the problem domain of object persistence. ![]() This process is often referred to as object-relational mapping (ORM). Bringing Java objects to the relational world is always a challenging and complex task for Java developers. On the other hand, when it is time to store the data, we have to rely on relational databases, where the data is traditionally represented in a row-column format with relationships and associations. The state is modeled to be persisted in durable storage so it will be permanent. Object persistence is a fundamental requirement of Java applications. Java developers always work with objects that represent state and behavior modeling real-world problems. There are two different software worlds: one is the Java world, where none other than objects are known, while the other is the relational database world, where data is king.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |