• Post Reply Bookmark Topic Watch Topic
  • New Topic

Basic DAO question  RSS feed

 
James Ward
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that DAO can be used as follows :
EJB > DAO > Database.
Can it be used as follows. Is this right ??:
EJB > DAO > Some other External System
Examples of external systems are like SMTP/another application.
 
James Ward
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that
EJB > DAO > External System
can also be
EJB > External System
What criteria would decide whether i should use DAO or not.
Would it be terribly wrong to use DAO always as a practice, when accessing any external system/data-source irrespective of whether you want to read or write ?
 
Thomas Hofmann
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should always decouple the EIS tier (database, legacy systems e.g. ERP, CRM, ...) from the EJB tier. The reason is: Don't intermingle proprietary integration code with EJB code (EJB business components) -> Maintainability.
For integrating databases you should either use BMP-DAO or CMP, for integrating systems like Siebel or SAP/R3 there are resource adapters according to the Java Connector Architecture. If you have to integrate a legacy system for which there is no resource adapter available, you can either write your own adapter or write integration code in an appropriate DAO.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!