Enterprise JavaBeans™ Component Architecture: Designing and Coding Enterprise Applications
by Gail Anderson, Paul Anderson
4.5. Data Access Object Pattern
The Music EJB shown in this chapter accesses a database using the JDBC's SQL interface. It works fine with Cloudscape's reference implementation of SQL (provided by Sun's J2EE reference implementation) but what happens if we change databases? How would this affect our code? Unfortunately, porting the current version of the Music EJB to a different database is not as smooth as one would like. Specifically, changes may be necessary to the bean implementation class, MusicBean.java. Although we isolated database access to separate private methods in the Music EJB, the EJB code must still be recompiled and redeployed.
The Data Access Object (DAO) pattern introduces a deeper level of abstraction for any EJB that accesses ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access