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#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...