Friday, April 6, 2012

EJB Remote Example

@Remote
public interface EmployeeBeanRemote {
List listEmployee();
}



@Local
public interface EmployeeBeanLocal {
List listEmployee();
}




@Stateless
public class EmployeeBean implements EmployeeBeanLocal, EmployeeBeanRemote {

@PersistenceContext(unitName = "EJB_ApplicationPU")
EntityManager em;


@Override
public List listEmployee() {
try {
return em.createQuery("Select a From Employee a").getResultList();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
.
.
.
}

No comments:

Post a Comment