• Post Reply Bookmark Topic Watch Topic
  • New Topic

Mapping classes to EJBs

 
Ashish Sarin
author
Ranch Hand
Posts: 444
10
  • 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 ?

thanks
Ashish
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!