package au.com.subash.session;

import au.com.subash.entity.Todolist;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author subash
 */
@Stateless
@LocalBean
public class TodoListFacade implements TodoListFacadeLocal {

    @PersistenceContext(unitName = "au.com.subash_Todo-ejb_ejb_1.0-SNAPSHOTPU")
    private EntityManager em;

    @Override
    public List<Todolist> getAll() {
        return new ArrayList();
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public boolean remove(int id) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public boolean create(Todolist list) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public boolean update(Todolist list) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
}

@@ -254,16 +254,53 @@
 Context;
+%0Aimport javax.persistence.TypedQuery;
 %0A%0A/**%0A *
@@ -580,169 +580,140 @@
     
-return new ArrayList();%0A        //throw new UnsupportedOperationException(%22Not supported yet.%22); //To change body of generated methods, choose Tools %7C Templates.
+TypedQuery%3CTodolist%3E query = em.createNamedQuery(%22Todolist.findAll%22, Todolist.class);%0A        %0A        return query.getResultList();
 %0A   

add get all todo list function