8 Replies Latest reply on May 24, 2011 2:39 PM by Jean Baldessar

    Change Datasource by HttpSession

    Jean Baldessar Newbie




      I have a web application in a three tier architecture with the state kept in HttpSession and the business logic in stateless session beans.



      The application uses JPA for persistence and the EntityManager is injected in the stateless session beans by the @PersistenceContext annotation.



      I need to change the datasource used acording with the user logged in the web application and I have no idea of how this can be possible.

      To pass a parameter that identifies the datasource to the stateless session beans is acceptable, but it's not desirable

      Will I have to use statefull session beans to keep the application state?


      I can't even change the datasource without change the persistence.xml...

      If the datasource cant be changed, I could change the persistence-unit to. Its all the same. I just dont know how to do it.


      some help?