Hi stryx.
In the most case, DAO pattern is a useful pattern in enterprise environments. Most
enterprise environments have a variety resource.(as RDB, file system, xml)
DAO pattern removes dependency between business object and resource.
In this case, performance you mentioned is fallen.
However
Hi,
you can find a good story on the pro's and con's on pages 76-80 of EJB Design
Patterns of Floyd Marinescu free downloadable at
http://www.theserverside.com/books/wiley/EJBDesignPatterns/downloadbook.tss
Good luck,
Evert Bende
I think that when when more objects are created it is better to use DAO else use
Entity Bean.
For example:
When you go for :Select * from Employee.
In this it will create a lot of EJBObjects.
Instead of that use DAO.
In case of inserting, updating and deleting use Entity Beans.
Hope it is
puneetjains wrote : Hi
| can any one please tell mewhen to use DAO or EJB
| is the selection also depends on No of hits.
| also are EJB not scalable
|
|
| Puneet
View the original post :
http://www.jboss.org/index.html?module=bbop=viewtopicp=3846857#3846857
Reply to the post :
As Sachin said, use DAO when the application is primarily of reporting type ( mostly
selects). When you require a lot of inserts and updates and real time persistance,
also when your java objects need to reflect the state of database objects go for
Entity EJBs.
Thanks,
Joydeep
View the
Hi Puneet,
Alternatively, if you want ease of development and neat code (therefore, easy to debug
code). You should use:
1. Vanilla Hibernate
2. BMP (replace JDBC with Hibernate)
3.Session Beans with Hibernate
Trust me, you'll save yourself a lot of trouble steering away from JDBC and CMP
EJBs are no doubt scalable. Usually you access data using
1. CMP
2. BMP
3. Sessions beans with JDBC.
Compare it to DAO that can help you to form your own persistence mechanism and policy
not only to RDBMS but to any kind of data store. be it XML/file system. But CMP/BMPs
can't help you with
DAO is a design pattern that can be followed to encapsulate database access from the
rest of your code.
i tend to use DAOs reguardless of whether or not i am using cmp, straight jdbc, etc
just b/c i like to keep that code centralized in one location and it allows me to
change the internals
Hi Puneet,
DAO is used to interact with database and other type of storages
where as EJB are your business domain entities. Generally they are used in
combination of each other except when you are using CMP type of beans.
The selection criteria is not based on no. of hits. and EJB's are the