Chapter 7. Leveraging JPA and Hibernate with Flex

Java is an object-oriented programming language and as such, applications built using it model domain entities as objects. Objects encapsulate data and behavior together and provide the familiar real-world semantics to interact with it. A majority of modern-day applications store persistent data in popular data storage engines like databases, most of which are relational in nature.

The world of objects and the world of relational entities view the same context from different perspectives, so mismatches exist between them. I will present a small example and illustrate some of the most common problems related to this mismatch. However, indulging in a thorough discussion on this topic is beyond the scope of this chapter.

Before I start digging into the example, it is worthwhile to state up front that the best known solution to the problem comes from the breed of tools classified under the Object Relational Mapping (ORM) category. Such tools reduce the impedance to the flow and data interchange between the objects and the relational formats. Hibernate is one such open source Java-based ORM solution. Hibernate is both extremely popular and well liked by Java developers.

Java Persistence API (JPA) is a Java Community Process (JCP)–created standard specification that defines the contracts and interfaces for ORM between Java and the relational world. Hibernate is a JPA implementation and so are TopLink and OpenJPA. Hibernate has features ...

Get Professional BlazeDS: Creating Rich Internet Applications with Flex® and Java® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.