[jboss-user] [JBoss Seam] - Is this the correct way to go about this?

joff do-not-reply at jboss.com
Thu Jul 13 00:13:51 EDT 2006


We are developing a Seam application using JBoss Seam current CVS, Sun JSF 1.2, and Facelets.

We currently have this type of model:

Our EJB3 entities are:
CompanyCustomerUser

Company has many customers, who in turn have many users.

We have developed what we are calling "DAOs" or Data Access Objects, so that we can pull out (for example) a List of all Company objects (this is outside of any form context so no EJB3 is currently involved).

For example, our CompanyDAO implementation looks like this:
@Name("dao_company")
  | public class CompanyDAOImpl implements Serializable, CompanyDAO {
  | 
  | 	private static final long serialVersionUID = 1L;
  | 	
  | 	@In(create=true)
  | 	private transient EntityManager entityManager;
  | 	
  | 	@SuppressWarnings("unchecked")
  | 	@WebRemote
  | 	public List<Company> getCompanies() {
  | 		Query query = entityManager.createQuery("FROM Company company");
  | 		return (List<Company>) query.getResultList();
  | 	}
  | }

We would like to add a getCompanyByID() method to this class. However, because this method needs to be called from the JSF layer, we have to pass in the parameter as a field annotated with @RequestParameter. When we do this, the getCompanies() method (which does not use the annotated parameter) can no longer be called unless this field is filled in.

We have two questions:
Is this the correct way to be doing this type of "pull" data access? We have looked at the "Blog" example, but it does not seem as complex as what we are trying to do.
Is it possible to have multiple @RequestParameter fields on a JavaBean like the one above, which do not all have to be populated when any given method (which may or may not use them) is called?

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

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



More information about the jboss-user mailing list