> I wonder if this is "the right way". If you use EJBLocal's without > dataobjects via JSP/taglibs, what transaction type do you use? If you > use "required" on each of the fine grained getter methods, each fine > grained get method will result in a database read/write. If you use > "supports" then the result is vendor specific. Under weblogic, an > unspecified tx results in a local tx on the entity bean, again, a db > r/w. > > Given the performance hit, I think we're always going to need value > objects... unless I'm missing something or I don't understand tx's.
If web and ejb tiers are collocated on same machine/jvm you can use locals with no performance hit (in fact despite all those claims that "now with local interfaces entities are fast" if you correctly tune your entities to use pass-by-reference you could reach performance of local interfaces with remote interfaces in ejb1.1). Honestly I think creating a whole new set of classes to support local interfaces was wrong. They could simply define a view-type param in dd file and warn developers that "never assume anything passed to an ejb is a reference", then by default container will pass by reference if possible but reverting back to pass by value if not. I'm just wondering how some vendors will adapt their design to clustered environments (say IBM in its CBC framework which is the most stupid ejb design IMO with everything modeled as entity beans!). Wrap your entities with a session fa�ade, handle transactions there. A good thing about session fa�ade is that you can organize it as a single entry point into your ejb tier, and this way you can lower coupling of tiers leading to a more modular design. Some say session facades are not needed in ejb2 (again because of local interfaces) but anyway I'll use it, it's a better design. And in fact we still need value objects, but it's now a bit twisted. As an example take a look at petstore 1.3. Look at CatalogEJB. getProducts(). It returns a Page object, Page has a List. The List is populated by Product objects in CatalogDAO. Product is really a value object, used in jsps. So you still need value objects for listing behavior. What they've done in petstore in regard to transaction on get/sets of local EJBs is to mark ejb methods REQUIRES and just call them one by one. There is a transaction covering these REQUIRES-marked methods, they start a UserTransaction in TemplateServlet which is a servlet called any time you do any web tier job, so the transaction started in this global web entry point propagates to local ejbs. Pretty clever trick! I'm on Websphere (ejb1.1) but I would still use data objects in ejb2 for this purpose too (if there's an overhead with transactions for the case in hand and the bean can not be marked read-only). I may be wrong cause I haven't actually coded an ejb2 application yet. I'll be happy to know that I'm wrong :o) Ara. _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _______________________________________________ Xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user
