5 Replies Latest reply on Nov 13, 2008 9:20 AM by victor han

    Also multiple datasource problem

    victor han Newbie

      hi,everybody
        i want to use two datasource in my application. Here is my configuration at persistence.xml



      <persistence-unit name="ddsPersistenceUnit"
                      transaction-type="RESOURCE_LOCAL">
                      <provider>org.hibernate.ejb.HibernatePersistence</provider>
                      <jta-data-source>java:comp/env/ddsdatasource</jta-data-source>




      <persistence-unit name="ddsPersistenceUnitAdls"
                      transaction-type="RESOURCE_LOCAL">
                      <provider>org.hibernate.ejb.HibernatePersistence</provider>
                      <jta-data-source>
                              java:comp/env/ddsdatasource_adls
                      </jta-data-source>



      at components.xml



      <core:init transaction-management-enabled="true" />
      
              <transaction:entity-transaction entity-manager="#{entityManager}" />
      
              <persistence:entity-manager-factory name="entityManagerFactory"
                      persistence-unit-name="ddsPersistenceUnit" />
      
              <persistence:managed-persistence-context name="entityManager"
                      auto-create="true" entity-manager-factory="#{entityManagerFactory}" />
      
      
              <persistence:entity-manager-factory name="entityManagerFactoryAdls"
                      persistence-unit-name="ddsPersistenceUnitAdls" />
      
              <persistence:managed-persistence-context name="entityManagerAdls"
                      auto-create="true"
                      entity-manager-factory="#{entityManagerFactoryAdls}" />




      The problem is:
      Yes, entityManager works well, but entityManagerAdls can not work. If i use entityManagerAdls to persist some entitys to data base, there is no exception,but these data can not be write to database...what's wrong?