The only change from the original is line 37 for line 36:

//$Id: MessageListBean.java,v 1.2 2006/01/14 20:13:46 gavin Exp $
  | package org.jboss.seam.example.messages;
  | 
  | import static org.jboss.seam.ScopeType.SESSION;
  | import static javax.persistence.PersistenceContextType.EXTENDED;
  | 
  | import java.io.Serializable;
  | import java.util.List;
  | 
  | import javax.ejb.Interceptors;
  | import javax.ejb.Remove;
  | import javax.ejb.Stateful;
  | import javax.persistence.EntityManager;
  | import javax.persistence.PersistenceContext;
  | 
  | import org.jboss.seam.annotations.Destroy;
  | import org.jboss.seam.annotations.Factory;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Out;
  | import org.jboss.seam.annotations.Scope;
  | import org.jboss.seam.annotations.datamodel.DataModel;
  | import org.jboss.seam.annotations.datamodel.DataModelSelection;
  | import org.jboss.seam.ejb.SeamInterceptor;
  | 
  | @Stateful
  | @Scope(SESSION)
  | @Name("messageList")
  | @Interceptors(SeamInterceptor.class)
  | public class MessageListBean implements Serializable, MessageList
  | {
  | 
  |    @DataModel
  |    private List<Message> messages;
  |        
  |    @Out(required=false)
  | //   @DataModelSelection
  |    @DataModelSelection("message")
  |    private Message message;
  |                
  |    @PersistenceContext(type=EXTENDED)
  |    private EntityManager em;
  |    
  |    @Factory("messages")
  |    public void findMessages()
  |    {
  |       messages = em.createQuery("from Message msg order by msg.datetime 
desc").getResultList();
  |    }
  |    
  |    public String select()
  |    {
  |       message.setRead(true);
  |       return "selected";
  |    }
  |    
  |    public String delete()
  |    {
  |       messages.remove(message);
  |       em.remove(message);
  |       message=null;
  |       return "deleted";
  |    }
  |    
  |    @Remove @Destroy
  |    public void destroy() {}
  | 
  | }
  | 

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

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


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to