struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Galbreath, Mark" <Galbre...@tessco.com>
Subject RE: Question on EJB/Session Bean usage from Action class, and som e rants...
Date Mon, 23 Sep 2002 11:45:07 GMT
Not if you are using stateful session beans, but I would use a stateless
session bean as a facade and rely on CMP entity beans for xactions.

Mark

-----Original Message-----
From: Bomb Diggy [mailto:techguy_chicago@yahoo.com]
Sent: Monday, September 23, 2002 4:02 AM

1) I plan on using Session beans to hit DB directly
using JDBC, and also to work with entity beans.  To 
provide transaction safety, it seems like my Action 
classes would be able to provide, at most, a simple 
pass-through of data (maybe a value/transfer object) 
to a single session bean method.  If I called more 
than one session bean, then I'd be busting-up the 
transaction, right?  Example below:

public ActionForward perform(
	ActionMapping       mapping,
        ActionForm          form_,
        HttpServletRequest  request,
        HttpServletResponse response)
throws IOException, ServletException
{
  // Get your form data
  MyActionForm form = (MyActionForm) form_;

  // Locate/get remote reference to your EJB SB
  EJBSessionBean sb = getMySessionBean();
        
  // Update some db data through your session bean
  ValueObjectBean vob1 = 
	sb.updateDataSource( form );

  // Wouldn't this break xactional integrity??
  ValueObjectBean vob2 = 
	sb.updateSomeOtherDataSource( form );

  // Make VOBs available to JSP
  request.setAttribute( "VOB1", vob1 );
  request.setAttribute( "VOB2", vob2 );

  // Send 'em to the next JSP
  return mapping.findForward( UPDATED_PAGE );
}



2)  Does anyone use ActionForms for validation?
--------------------------------------------------
I will do all of my form validation on the client 
side - using Javascript.  The only reason I'd use 
an ActionForm to do validation is possibly to 
improve security in case a would-be hacker decides 
to have a little fun.  But even then, it seems a 
waste.  ActionForms *do* seem like a good way to 
get HTML data into a digestable form (pi), and I 
guess they play a part in redisplaying data should 
something later on down the line (maybe in the EJB 
layer) goes sour (dupe PK).  But what am I missing 
about ActionForms and the much-balleyhooed 
'validation' they provide?


3)  Should an EJB Session Bean ever be used as 
    anything other than a 'Facade'?  
----------------------------------------------------
Is it asking too much for people to not throw around 
these design pattern words and append them to the 
names of all their classes unless they actually 
intend them to *mean* something.  Pick one:  Session 
Beans, or Facade Beans - but not Session Facade 
Beans, nor Facade Session Beans.  I'm leaving it 
up to y'all.  Do the right thing.


4)  Why is everyone concerned with having 15+ 
    'layers' of architecture?
-----------------------------------------------------
People - the number of lines of code never indicated 
quality, nor does the number of layers in your 
architecture.  In fact, more times than not, I'd say
the number of layers one employs is inversely 
proportional to one's level of self-confidence.  
Now, run along good little sheep.


Thanks for the mic...


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message