Stateless Session beans with plain Java objects
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   neal_ravindran
Posted On:   Wednesday, December 11, 2002 05:00 AM

What is the disadvantage in using Stateless session beans(SLSB) to do the queries which make plain java objects as results? For example, to get an array of line items for a particular orderId, I make a plain java LineItem class with all the attributes as in DB for the LineItem table. Then in the Controller/servlet code I instantiate a SLSB and do a query such as getLineItems(orderId). getLineItems(orderId) is defined as a method in the SLSB and returns a LineItems array. What gets done inside getLineItems() is a select-sql-query against the 'orderId' passed in as parameter. Looping over the ResultSet, the LineItems array is manufactured and returned from the function Any disadvantage in having this architecture for my J2EE app? Won   More>>

What is the disadvantage in using Stateless session beans(SLSB) to do the queries which make plain java objects as results?


For example, to get an array of line items for a particular orderId, I make a plain java LineItem class with all the attributes as in DB for the LineItem table. Then in the Controller/servlet code I instantiate a SLSB and do a query such as getLineItems(orderId). getLineItems(orderId) is defined as a method in the SLSB and returns a LineItems array. What gets done inside getLineItems() is a select-sql-query against the 'orderId' passed in as parameter. Looping over the ResultSet, the LineItems array is manufactured and returned from the function



Any disadvantage in having this architecture for my J2EE app? Won't this be faster[for coding(3 files for Entity beans or one file for pure java class?) and performance]and more scalable than defining and using an Entity Bean for LineItem table? Also I can,if I need, place the getLineItems under a transaction...(probably not a get function, but some update/delete function in the SLSB via the ejb-jar.xml...but you get my point-->I can use transactions with SLSB). I really don't see the point in using Entity Beans!

   <<Less

Re: Stateless Session beans with plain Java objects

Posted By:   Lasse_Koskela  
Posted On:   Wednesday, December 11, 2002 05:41 AM

This is an established EJB design pattern. The trend nowadays is to diss EntityBeans but that's for a reason - the features of EntityBeans come with trade-offs and most of the features are not needed by mainstream applications (i.e. webshops, news providers, etc. read-mostly services).
About | Sitemap | Contact