[jboss-user] [JBoss Seam] - Re: Query that selects all rows.

cocampo do-not-reply at jboss.com
Fri Oct 13 13:26:13 EDT 2006


First, take a look at this code:


  | @Stateful
  | @Scope(SESSION)
  | @Name("messageManager")
  | public class MessageManagerBean implements Serializable, MessageManager
  | {
  | 
  |    @DataModel
  |    private List<Message> messageList;
  |    
  |    @DataModelSelection
  |    @Out(required=false)
  |    private Message message;
  |    
  |    @PersistenceContext(type=EXTENDED)
  |    private EntityManager em;
  |    
  |    @Factory("messageList")
  |    public void findMessages()
  |    {
  |       messageList = em.createQuery("from Message msg order by msg.datetime desc").getResultList();
  |    }
  | 

As you may see near the end, there is an invocation to the getResultList method, which gives you the list you're looking for.

Second, next time you have a question like this, please take a look at the manual, since this code is in Chapter 1!!!. If you keep asking things like this you will be soon ignored (maybe ppl is already ignoring you).
Please, take your time to read the manual, which is very well documented, read the Wikis (Getting Started, FAQ's, etc.), study the examples, and ONLY THEN come and post your questions (after searching for existing answers to the same problem, of course ;)).

Regards.

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

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



More information about the jboss-user mailing list