[jboss-user] [JBoss Seam] - desing pattern for remote accessing

mateusz.mrozewski do-not-reply at jboss.com
Tue May 29 01:46:17 EDT 2007


Hello,
I am looking for correct design pattern which will allow me to access data via EJB remotly. I want to have a single point of enterance both for SEAM application and for other applications, which use the same data. 

My current idea is to have:
- Stateless EJB acting as a DAO
- Stateful EJB, acting as a seam action
- JSF as a presentation layer

The stateful EJB calls the stateless to get the data. It also additionally has a remote interface which allows other application to call it. Due to convetions of seam I have to "double" the interface, for example:

  | @DataModel
  | private List<Contact> contacts;
  | 
  | @DataModelSelection
  | private Contact contact;
  | 
  | @Factory("contacts")
  | public void findAll() {
  |   if(contacts == null) {
  |     contacts = myStatelessBean.findAll();
  |   }
  | }
  | 
  | public List<Contact> getContacts() {
  |   findAll();
  |   return contacts;
  | }
  | 

I find this sollution quite innatural, because you have to implement two interfaces, which do quite the same thing. The other idea is to develop a facade, but it introduces another problem: passing parameters and returning values - it is done by @In and @Out annotations in seam. You will have to call additional methods from facade to set parameters and get the returning values.

Which sollution is better? Maybe you know a better sollution for this problem?

thx

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

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



More information about the jboss-user mailing list