Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Entity Beans /DAO's

 
Balaji Rajagopalan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

I have some doubt regarding the usage of Entity Bean and DAO in part2 assignment. As DAO can also be used for Rean and Write Operations from DB , is that neccessary to use Entity Bean .
 
Cleuton Sampaio
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, please note that I haven�t received my results yet.

But I have used only DAOs in my assignment. I have seen some people using Entities and passed the exam too. But, if you look at Mark Cade�s book, you will see that he used only DAOs.

According with CORE J2EE PATTERNS book, plain entities should not be used. Instead, you should use Composite Entities. The problems with Entities are: heavy load on the application server and database lock.
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Cleuton,

You said:

But I have used only DAOs in my assignment. I have seen some people using Entities and passed the exam too. But, if you look at Mark Cade�s book, you will see that he used only DAOs.


If we look at the Browse Catalog sequence diagram on page #174, we see the ShoppingCart and Product. Are they DAOs? And what about his Class diagram?

Regards,
Dan
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Balaji,

As Cleuton said, the Core J2EE Patterns book speaks about this issue. It says that using DAOs only, can be sufficient in many cases and in some other cases, entity beans can help in scaling up the application.

So, it's up to us to decide how to architect the solution for our assignment.

Regards,
Dan
 
Petr Kleja
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi collegues. Allow me to express my opinion. According J2EE Core Patterns DAO can be used instead of "read only" entity beans because main drawback of using entity beans is method ejbStore() that is called also in cases when there is no need for an update.
Using DAO we can separate read-write functionality. I think that nowadays it is very questionable whether to use DAO or Entities with CMP. So far I am thinking about modern second way (entities with CMP), because nowadays J2EE Containers are very efficient.

I am not still decided whether I should prepare my architecture for "old" environment or to take in account EJB 2.0.

Petr (SCJP, SCBCD, SCWCD, SCMAD, SCDJWS, SCEA-I)
Czech republic, Prague
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic