If I'm understanding correctly, you want to use a more "spring like"
service/dao design for developing your application? .You can implement DAOs and
have them injected into your stateful beans :
I think you can implement your DAOs as stateless session beans since the only
'state' you have is injected each time the bean is called :
(forgive the syntax errors)
| @Stateless
| @Name("personDAO")
| public class PersonDAOBean implements PersonDAO {
|
| @PersistenceContex
| private EntityManager em;
|
| public List<Person> findPeopleByFirstName(String firstName) {
| return em.createQuery("Select p from person where firstName =
:firstName)
| .setParam("firstName",firstName)
| .getResultList();
| }
|
|
In your action bean part, simply inject the DAO into it
| @Name("personSearch")
| @Stateful
| @Scope(CONVERSATION)
| public class PersonSearchBean implements PersonSearch {
|
| @In
| private PersonDAO personDAO;
|
| private List<Person> results;
| private String firstNameParam;
|
|
| public void doSearch() {
| results = personDAO.findPeopleByFirstName(firstNameParam);
| }
|
| ...
|
or something like that.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043331#4043331
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043331
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user