• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Entity Bean and DAO for same business entity

 
Manish Limaye
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is it OK to represent same business entity using Entity Bean and DAO? The idea is the use entity bean when working with single object (read/write) and use DAO when traversing through large number of objects? One good example is Seat class. We can use EJB for assign/unassign seat but DAO for SeatMap.

Regards,
Manish
 
Devender Thareja
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see any reason why not. In fact that's the reason BMP entity beans are there for. Some of beans you can make BMP and use DAO for persistence. This way you are consistent in your use of EJB in your design. I am looking forward to see reply from others on this.
 
Beppe Catanese
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think of an approach where I have a CMP entity for the basic unexpensive methods (add/edit/delete/get) and have a DAO fon only the multi-record methods (e.g. listAll, listByFilter).
In this way you can avoid coding the add/edit/delete/get (since the EJB container takes care of those) and, at the same time, get the benefits of DAO for retrieving large set of records (applying Value List Handler).

Obviously I would hide those 2 separate Business Objects behind a Session Facade (SLSB).

Does it make sense to you guys?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic