[jboss-user] [JBoss Seam] - @DataModel makes me go nuts or it's a bug ?

dexjam do-not-reply at jboss.com
Fri Dec 28 18:29:51 EST 2007


Either this is a bug, or possibly i don't get it, why is this working:

--- BEGIN DOES work (TM) ---
  | @Stateful
  | @Name("admin")
  | public class AdminUserBean implements Serializable, AdminUser {
  | 
  |     @PersistenceContext()
  |     private EntityManager entityManager;
  |     
  | //    @DataModel()
  | //    private List<User> userList;
  |     
  |     @Logger Log log;
  |     
  |     /*@Factory("userList")
  |     public void fetchUserList() {
  |        userList = entityManager.createNamedQuery("User.findAll").getResultList();
  |     }*/
  |     
  |     @Factory("userList")
  |     public  List<User> getUserList() {
  |         return entityManager.createNamedQuery("User.findAll").getResultList();
  |     }
  |     
  |     @Remove
  |     public void destroy() {
  |         //No special treatment
  |     }
  |     
  | }
  | --- END DOES work (TM) ---

and this isn't???

--- BEGIN DOESn't work (TM) ---
  | @Stateful
  | @Name("admin")
  | public class AdminUserBean implements Serializable, AdminUser {
  | 
  |     @PersistenceContext()
  |     private EntityManager entityManager;
  |     
  |     @DataModel()
  |     private List<User> userList;
  |     
  |     @Logger Log log;
  |     
  |     @Factory("userList")
  |     public void fetchUserList() {
  |        userList = entityManager.createNamedQuery("User.findAll").getResultList();
  |     }
  |     
  |     /*
  |     @Factory("userList")
  |     public  List<User> getUserList() {
  |         return entityManager.createNamedQuery("User.findAll").getResultList();
  |     }
  |     */
  |     
  |     @Remove
  |     public void destroy() {
  |         //No special treatment
  |     }
  |     
  | }
  | --- END DOESn't work (TM) ---

The facelets page is:


  | <?xml version='1.0' encoding='UTF-8' ?>
  | <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  | <ui:composition xmlns="http://www.w3.org/1999/xhtml"
  |                 xmlns:ui="http://java.sun.com/jsf/facelets"
  |                 xmlns:h="http://java.sun.com/jsf/html"
  |                 xmlns:s="http://jboss.com/products/seam/taglib"
  |                 xmlns:rich="http://richfaces.org/rich"
  |                 xmlns:f="http://java.sun.com/jsf/core"
  |                 template="../templates/myTemplate.xhtml">
  |     
  |     <ui:define name="content">
  |         <h:messages/>
  |         <h2>User list size: #{userList.size()}</h2>
  |         <h:dataTable value="#{userList}" var="singleUser">
  |             <h:column>
  |                 <h:outputText value="#{singleUser.id}"/>
  |             </h:column>
  |         </h:dataTable>
  |         
  |     </ui:define>
  |     
  |     </ui:composition>
  |     

Anybody, please enlighten me or point me to some very explicit documentation please.

Jens

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

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



More information about the jboss-user mailing list