[jboss-user] [JBoss Seam] - Re: DAO's: stateless or not

ruettimac do-not-reply at jboss.com
Tue Jan 15 00:31:45 EST 2008


Hi,

I am thinking about the same question - should I or should I not. The main problem is, that I have implemented certain queries (load the current user from the database for example) the second time in my action beans and it is time for a refactoring.

You have two options in my opinion:
 Since seam is a component framework, you can also inject another component (action in example terms) into another component. So I have an action coping with customers which implements the query to load a certain user. Another component needs the user to load the computers of the user (toMany relationship). So I can inject the user action into the computer action.
  | 
  | Second option is to create a DAO. Since EJB3 is more object oriented than the previous specifications, I do not like to add a DAO-Layer. In my opinion, it has to be more simple - queries and persistence functions should also be in the entity bean, so I have all logic in the entity bean or my business object. The entity bean is now as intelligent as it should be; It can load itself, can query for itself and can operate on itself (business specific).
  | 
  | 
  | An interesting question is, how seam will handle the different scope definitions if you inject components into other components. For example, if you inject (@In) a component with scope EVENT into a component with Scope CONVERSATION.
  | 
  | Regards,
  | 
  | Cyrill

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

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



More information about the jboss-user mailing list