1 Reply Latest reply on Nov 7, 2007 11:44 AM by norman.richards

    One

    statelessbean

      Hi,
      I found this declaratiorn in seam docs:

      <components xmlns="http://jboss.com/products/seam/components"
       xmlns:persistence="http://jboss.com/products/seam/persistence"
      
       <persistence:managed-persistence-context name="customerDatabase"
       persistence-unit-jndi-name="java:/customerEntityManagerFactory"/>
      
       <persistence:managed-persistence-context name="accountingDatabase"
       persistence-unit-jndi-name="java:/accountingEntityManagerFactory"/>
      
      </components>
      


      I understand that this enable to use 2 em's for two different db.
      Let's think I got login page and dropdown list to choose db like :
      db 1 , db 2, how to manage that?

      Do I need to declare Two differend em in my source code? or maybe is way to do it dynamically?

      Can anyone show me code how to do it?

        • 1. Re: One

          I think the simplest action would be to create an @Factory component that will call Component.getInstance() for whichever managed persistence context you want.