Web design - 122 Chapter 6 Mapping objects to relational data

122 Chapter 6 Mapping objects to relational data can be done in two ways. You can either handcraft this mapping in your code or use an object-relational mapping product, such as Oracle TopLink, or open source tools, such as Hibernate, to automate or facilitate this mapping. These tools have become increasingly popular. Handcrafted mappings using a database access API such as JDBC are becoming less frequently used because the cost of developing and maintaining an object-relational mapping layer is significant. The Sun Java Data Objects (JDO) specification, available as JSR 12 from the Java Community Process (JCP) Web site at www.jcp.org, defines portable APIs to a persistence layer that is conceptually neutral to the database technology used to support it. It can thus be implemented by vendors of relational and object- oriented databases. According to recent announcements, future versions of the EJB specification are going to be more closely aligned with container-independent persistence mechanisms, such as Hibernate, TopLink, and JDO. Now that we ve whetted your appetite with persistence mechanisms, let s take a look at how entity bean persistent objects are used in an EJB multitier environment. What Is an Entity Bean? In any sophisticated, object-oriented multitier deployment, we can draw a clear distinction between two different kinds of components deployed. Application logic components. These components are method providers that perform common tasks. Their tasks might include the following: Computing the price of an order Billing a customer s credit card Computing the inverse of a matrix Note that these components represent actions (they re verbs). They are well suited to handling business processes. Session beans model these application logic components very well. They often contain interesting algorithms and logic to perform application tasks. Session beans represent work being performed for a user. They represent the user session, which includes any workflow logic. Persistent data components. These are objects (perhaps written in Java) that know how to render themselves into persistent storage. They use some persistence mechanism, such as serialization, O/R mapping to a relational database, or an object database. These kinds of objects represent data simple or complex information that you d like saved. Examples here include:
Our facility is located in Orlando, Florida. Our Orlando web hosting data center gives you assurance that your website will work smoothly . Check more in Orlando Web Hosting.

Leave a Reply