Java Reference
In-Depth Information
• You should prevent the unnecessary mixing of business logic with persistence
• The entity bean is an obsolete technology.
• The business tier required a consistent API to access integration tier components.
• Working directly with the JDBC API leads to a lot of boilerplate code being written,
thus degrading reusability and increasing development time.
Implement a data access object (DAO) to encapsulate the data access logic and provide a
consistent interface to the business tier components.
Strategies with the Spring Framework
As the name suggests, DAOs are generic objects and theoretically can support any kind
of persistence store. The primary goal of these classes is to abstract the underlying data
access mechanism from the business services. Since most applications interact with
RDBMSs, I will focus only on JDBC-based data access objects.
The Spring JDBC module implements robust object design principles that make it
simple to develop JDBC-based DAOs. It takes care of all the boilerplate code generally
associated with JDBC API usage and helps provide a consistent API for data access.
Application developers are no longer required to work directly with the JDBC API;
instead, they work with a high-level API.
Because eInsure had an affinity for Oracle owing to its legacy, the SQL syntax used in
the next few sections will be compatible with Oracle Database. But the general discussion
and concepts hold true for any database, and using them merely involves making minor
changes in the SQL statements. Listing 5-2 shows the Oracle script to create the
T_POLICY_DETAIL table and corresponding sequence.
Listing 5-2. createTbl_T_Policy_Detail.sql
Search WWH ::

Custom Search