Is it good practice to use a SLSB in front of the EJB 3.0 entity POJO? Clients 
would always use this facade to access create(), remove(), finders, etc, rather 
than calling the entity directly.

This is the pattern implied by the 2.1 --> 3.0 entity migration article at 
http://www.oracle.com/technology/pub/articles/vohra_ejb.html (Oracle 
appserver-centric, but generalizable to all EJB 3.0 implementations). In terms 
of the finders, the entity itself would contain the NamedQuery annotations, 
which are referenced by the facade's query methods.

Another option would involve putting more logic in the entity itself, perhaps 
static methods to accomplish the above tasks (create, remove, finders) so 
clients would access the entity directly.

Here are some pro/con arguments for the facade:

(pro) If EJB 3.0 entity POJOs are meant to flow through the system as value 
objects (and I know this is arguable), then the create, remove, finder methods 
might clutter their interface. A facade provides a layer of indirection so that 
the entities look more like simple value objects (although on steroids with 
annotations). 

(pro) A facade is a nice place to put the potentially useful load-level logic 
suggested by Martin and illustrated by r_q_d in this forum 
(http://www.jboss.com/index.html?module=bb&op=viewtopic&t=73263&postdays=0&postorder=asc&start=20)
 

(con) Yet another layer of SLSBs - EJB 3.0 was supposed to "simplify" my 
architecture

(con) Performance concerns with an additional SLSB (I don't think this a major 
issue)

Thanks in advance for your input!


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3918854#3918854

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3918854


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to