• Post Reply Bookmark Topic Watch Topic
  • New Topic

Mapping classes to EJBs  RSS feed

Ashish Sarin
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I have a simple question regarding the mapping of classes ( identified during analysis phase ) to EJBs.

Lets say, I identified an object X (ProductCatalog)to contain a collection of objects Y (Product). In terms of plain Java, this requires creating two classes because if I need to get a Product based on an ID then the getProduct(s) method is provided by the ProductCatalog class. If I look at mapping these two classes to EJBs ( Product and ProductCatalog ) then I dont see a reason to create a ProductCatalog EJB because if Product is implemented as an EntityBean then the method getProduct(s) in its home interface will anyways provide the list of matching products. So, what happens to ProductCatalog class that was identified in the initial OOAD phase ? It becomes a Stateless Session EJB because direct access to EntityBeans is not a good design choice ? But if I don't use the ProductCatalog Stateless Session EJB in my implementation then the ProductCatalog class actually never shows up in my final implementation of the application ?

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!