Admin guide section 4.2.1 how to store entities in separate dbs

Developers
2014-02-08
2014-02-11
  • Patrick Freeman

    Patrick Freeman - 2014-02-08

    I am trying to figure out how to enable different entities in different dbs ... does this mean running separate tomcat instances for each entity, or can you configure the different connector in tomee.xml and specify the segment mapping somewhere else?

     
  • Werner Froidevaux

    Unfortunately this is not possible with version 2.12 of openCRX. Currently, only one JDBC datasource can be configured for a persistence manager in the jdoconfig.xml (located in ./opencrx2/core/src/jar/opencrx-resources.jar/META-INF).

    This feature will be available in future versions where a custom datasource selection is possible.

      E.g. in Kernel.properties
      PERSISTENCE/datasourceName[0]=java:comp/env/jdbc_opencrx_CRX_DEFAULT
      PERSISTENCE/datasourceName[1]=java:comp/env/jdbc_opencrx_CRX_S1
      PERSISTENCE/datasourceName[2]=java:comp/env/jdbc_opencrx_CRX_S2
      PERSISTENCE/datasourceName[3]=java:comp/env/jdbc_opencrx_CRX_S3
    

    And then method getDataSource() of custom-specific persistence plug-in:

      @Override
      protected DataSource getDataSource(
         DataproviderRequest request
      ) throws ServiceException {
         String segmentName = request.path().get(4);
         if("S1".equals(segmentName)) {
             return this.dataSources.get(1);
         } else if("S2".equals(segmentName)) {
             return this.dataSources.get(2);
         } else if("S3".equals(segmentName)) {
             return this.dataSources.get(3);
         } else {
             return super.getDataSource(request);
         }
      }
    
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks