Bug in @Datamodel ?!?
dexjam Dec 29, 2007 6:45 PMMaybe here some one can answer this.
I am running on
- JbossAS 4.2.2
- Seam 2.0.0.GA
Either it's abug in @Datamodel, or it's stupid me ...
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 for this code is pretty straight forward:
<?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>
Somebody, please enlighten me how i can make the @Datamodel example work correctly or what is actually happening, that prevents it from working.
Jens