  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | CMP - DAO | CMP - DAO 2004-09-17 - By Ricardo de Souza Moura
Back I have read about CMP and DAO, and Some people said that when I use CMP, DAO don't make sense... But What if I want to have the possibility to change to JDBC DAO for sample ? I would have to change all my business method, wouldn't I ? But If I make a DAO like this:
public class EJBFamilyDAO implements IFamilyDAO {
Context context = null; FamilyHome home = null;
/* * (non-Javadoc) * * @(protected) com.shoptime.integration.crmerp.persistence.IFamilyDAO#insertFamily(java.lang .String) */ public void insertFamily(String pFamilyName) { // TODO Auto-generated method stub home.create(pFamilyName); }
/* * (non-Javadoc) * * @(protected) com.shoptime.integration.crmerp.persistence.IFamilyDAO#findFamilyByName(java .lang.String) */ public FamilyVO findFamilyByName(String pName) { // TODO Auto-generated method stub return home.findBFamilyByName(pName); }
public EJBFamilyDAO() { try { context = new InitialContext(); home = context.lookup(...); } catch (Exception e) { e.printStackTrace(); } }
} Wouldn't it be more easy to change my business method? I only need change my DAO Implementation, don't I ?
Thanks in advance
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ __ MSN Messenger: converse com os seus amigos online. http://messenger.msn.com.br
==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
|
|
 |