The Persistence Tier in Java

Encoder QR Code in Java The Persistence Tier
CHAPTER 9 The Persistence Tier
Quick Response Code Encoder In Java
Using Barcode maker for Java Control to generate, create Denso QR Bar Code image in Java applications.
Presentation and business tiers should not depend on the persistence mechanism You should keep the business model and the presentation independent of the internal details of the persistence Ideally, you should be able to replace the persistence mechanism or the database without affecting the other tiers In a classical distributed architecture, the persistence layer of a Web application separates the model objects from the datastore The business tier uses the persistent layer to access the data By using this layer, the business tier does not need to know whether a database or a file is used to store objects The implementation of the persistence tier will differ for a relational database, an XML store, or an object database The persistence layer accesses these datastores without exposing the details of their technology to the rest of the application The details of datastore-specific mechanisms and languages, such as SQL, are cleanly abstracted away from the business logic This way you can change the persistence implementation without affecting the rest of the application Persistence layer APIs must be transparent and simple to access Recall the discussion in 8 The data layer interfaces abstract the datastore (see the section, The Data Access Layer) from the details of storage technologies, such as SQL, and object-mapping technologies from the business tier A simple persistence layer API can be summarized as having the following set of operations:
Print Bar Code In Java
Using Barcode generator for Java Control to generate, create bar code image in Java applications.
Create, read, update, and delete (CRUD) operations for persistent objects defined in the business layer Create and run queries; encapsulate query languages Manage connections, transactions, caching, performance, and object identity
Recognize Bar Code In Java
Using Barcode recognizer for Java Control to read, scan read, scan image in Java applications.
Designs for the Persistence Layer
Printing QR Code JIS X 0510 In Visual C#
Using Barcode encoder for .NET Control to generate, create QR Code image in .NET framework applications.
In this chapter we will look at the most common type of persistence mechanism used for Java objects: relational databases When you use relational databases, you need to translate Java objects into database tables, columns, and records as well as translate relationships, such as inheritance, dependencies, and references, into additional columns or tables The following practical designs are available for building a persistence layer (see Figure 91)
Encoding QR Code JIS X 0510 In VS .NET
Using Barcode encoder for ASP.NET Control to generate, create QR Code image in ASP.NET applications.
Use JDBC APIs to map objects to a database Use entity beans to map objects to a database Use object-relational frameworks to map objects to a database
QR Code Drawer In VS .NET
Using Barcode generation for VS .NET Control to generate, create QR-Code image in .NET framework applications.
Designs for the Persistence Layer
QR Code Generation In VB.NET
Using Barcode creator for Visual Studio .NET Control to generate, create QR image in .NET framework applications.
Client and Presentation Tier
Paint European Article Number 13 In Java
Using Barcode drawer for Java Control to generate, create European Article Number 13 image in Java applications.
Service Layer
Print UCC-128 In Java
Using Barcode encoder for Java Control to generate, create EAN / UCC - 14 image in Java applications.
(Fa ades)
Code 3/9 Printer In Java
Using Barcode encoder for Java Control to generate, create Code 39 Full ASCII image in Java applications.
Domain Model
Generate Code-128 In Java
Using Barcode drawer for Java Control to generate, create Code 128 Code Set A image in Java applications.
(POJO)
Make UPC-A Supplement 2 In Java
Using Barcode creator for Java Control to generate, create GTIN - 12 image in Java applications.
Data Layer
ANSI/AIM Code 93 Creation In Java
Using Barcode maker for Java Control to generate, create ANSI/AIM Code 93 image in Java applications.
(DAO Interfaces)
ANSI/AIM Code 39 Scanner In .NET
Using Barcode scanner for VS .NET Control to read, scan read, scan image in VS .NET applications.
Business Tier
Code-128 Creator In VS .NET
Using Barcode drawer for .NET Control to generate, create Code 128 Code Set C image in VS .NET applications.
Persistence Tier 1 JDBC DAO (DAO Implementation) JDBC API Persistence Tier 2 EJB CMP DAO (DAO Implementation) Remote Stubs rmi/iiop SQL
Code-128 Creator In Visual Basic .NET
Using Barcode creation for .NET framework Control to generate, create Code 128B image in .NET framework applications.
EJB container CMP Java EE SQL
Bar Code Printer In .NET
Using Barcode generator for ASP.NET Control to generate, create barcode image in ASP.NET applications.
Persistence Tier 3 O/R Mapping DAO (DAO Implementation) ORM Framework
Draw Bar Code In Visual Studio .NET
Using Barcode encoder for VS .NET Control to generate, create bar code image in VS .NET applications.
Game Table id
Data Matrix ECC200 Drawer In Visual Studio .NET
Using Barcode drawer for ASP.NET Control to generate, create Data Matrix 2d barcode image in ASP.NET applications.
Game Table id
DataMatrix Printer In VS .NET
Using Barcode creator for .NET Control to generate, create ECC200 image in VS .NET applications.
Game Table id
RDBMS
RDBMS
RDBMS
Figure 91 Kinds of Persistence Designs
The object-relational (O/R) design is the one most recommended for building a persistence layer However, in this chapter we will use a simpler approach and show how to use WTP for developing the persistence layer using both JDBC and entity beans
Use JDBC APIs to Map Objects to a Database
In this design, Java classes in the data layer embed SQL code using JDBC to implement the persistence API This approach allows you to write code very quickly and encapsulate persistence logic in one place The JDBC APIs are simple, but they require a good understanding of relational databases and SQL technology Since SQL is exposed, they offer very little in terms of transparency This approach is useful for building quick and small applications The most important disadvantage is the strong coupling between the database schema and Java classes Any change in the database requires a change in the Java code
CHAPTER 9 The Persistence Tier
The JDBC API provides Java applications with standard access and manipulation of data stored in relational databases It is a call-level API for SQL-based database access and includes interfaces for establishing connections to a database, accessing tabular data sources, executing SQL statements, and processing the results The JDBC architecture provides interfaces for both application developers and database vendors Database vendors implement drivers using these interfaces to support their own database protocols and servers This architecture allows developers to write applications that are independent of the database servers A simple JDBC application typically connects to a database, executes queries, and retrieves and processes the results (see Example 91)