First of all, I think this post is closelly related with original topic: build 
session beans that encapsulates commom business logic, taking advantage of Seam 
annotations (inheritance of annotaded members: @in, @out, @datamodel, 
@datamodelselection, @begin, @end, @destroy, etc).

Please tell me exatly the reasons you think the topics aren't related, so I'll 
be convinced to create a new topic.

The code I sent is just a draft based on original code. The implementations are 
ok, and what I see it's happening is problems with EJB proxying. 

In the following codes, *Service refers to interfaces, and *Manager refers to 
Stateful Session Bean classes.

When I write single (direct) hierarchies
BusinessManager implements BusinessService
everything runs allright.

But I'll have to write interfaces UserService, CompanyService, EmployeeService, 
ContactService, etc... that closelly shares the same structure (methods save(), 
search(), select(), destroy(), etc...).

And worse: the implementations (BusinessManager) are identical in the vast 
majority of cases. Just in few cases a subclass will need to override the 
default BusinessManager behavior.

So ideally, the best thing to do would be:


  | interface BusinessService (common Service method declarations)
  | 
  | BusinessManager implements BusinessService (default implementations)
  | 
  | interface UserService extends BusinessService (declares User related 
methods)
  | 
  | UserManager extends BusinessManager implements UserService
  | (UserService implementations and some BusinessManager overriding)
  | 

But in this case, only UserService methods are proxied in the UserManager 
objects (exception occurs when trying to invoke BusinessManager methods - the 
exception says the UserManager proxy don't have the related BusinessManager / 
BusinessService methods).

If needed, in the next reply I send the UserManager code I've mentionated.

Thanx
Fábio.

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

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

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to