• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why we use DAO between Entity Bean and Data Base

 
murali kankanala
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

What is use of using DAO design pattern between Entity Bean and Data base.
I heard that it will improve the performance , but how it is improving the performance i can not understand.

If u can explain clearly it will be great.
Expecting best explanation from any one.
 
Potti Ramesh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bcoz, by Using DAO we can use any database(Oracle,DB2) with minimal efforts.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ramesh Potti:
bcoz, by Using DAO we can use any database(Oracle,DB2) with minimal efforts.


Of course with Entiry Beans we can switch the underlying database without any code changes regardless of whether we use a DAO or not (at least, that's the theory).

Using DAOs between your application and the Entity Beans themselves makes sense, since then you can decide to stop using Entity beans and start using another ORM (or even a non-relational source) without too much of an impact on your code. However using them between Entity Beans and the RDBMS is an odd thing to do. DAO are there as an abstraction layer, pretty much in the same way that Entity beans are an abstraction layer. I don't see any benefit at all. I suppose if you are using Bean Managed Persistance you might want to abstact that persistance code in some way, but it sound like an over complication to me. It certainly is very unlikely to improve performance much anyway.
[ April 13, 2006: Message edited by: Paul Sturrock ]
 
murali kankanala
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ramesh,

Thanks for the reply. But i did not get the clear explanation.
I knew that DAO used between EntityBean and Database if your application is to be database independent.

Even we can do the same code that you are using in DAO , then how to do with minimal efforts.
 
t pillai
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A BMP Entity bean uses a DAO to execute database opertaions (specific to a DB like Oralce).
A CMP Entity bean typically uses internal DAO (not created by bean developer).

check out :
http://forum.java.sun.com/thread.jspa?threadID=563234&messageID=2773263

my 2 cents

:-)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!