1 Reply Latest reply on Nov 21, 2008 10:29 PM by pedrosena

    Different schema in DB for each client. Can Seam manage this?

    pedrosena

      Hi Guys,


      I'm working with a legacy system(an online ERP/CRM) that has, for each cliente, a specific schema in the database.


      All the schemas have the same tables, but each user has it own schema.


      I would like to know how I can use the Seam-Managed EntityManager with this scenario.


      I suppose that I need a different EntityManagerFactory for each client. I created my own EntityManagerFactory that retrieves the correct EntityManager using a client information but I don't know how to integrate it in a way that my container can handle this for me.


      I need to use a seam-managed entityManager because it would solve my lazy exceptions problems.


      Thanks for your time,


      Pedro Sena

        • 1. Re: Different schema in DB for each client. Can Seam manage this?
          pedrosena

          Hi Guys,


          I was thinking in using the following approach:


          1) When the user makes the login I create its correct EntityManager and store it in Seam context.


          2) In other parts of my application that require an entityManager I would retrieve it using @In (I'm really newbie to Seam, if I'm saying something incorrect, please point it).


          But I have a doubt with this approach:


          Using a entityManager that I created, will I still have the container management of this entityManager ? Will I have problems with transactions using this solution ?


          Thanks again,


          Pedro Sena