Guest User

Untitled

a guest
Jan 16th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. @Override
  2. protected ConnectionProvider selectConnectionProvider(String tenantIdentifier) {
  3.  
  4. if( "xml1".equals(tenantIdentifier) )
  5. return xml1;
  6.  
  7. if( "xml2".equals(tenantIdentifier) )
  8. return xml2;
  9.  
  10. return null;
  11. }
  12.  
  13. MultiTenantConnectionProvider multiTenantConnectionProvider =
  14. ( (SessionFactoryImplementor) sessionFactory )
  15. .getServiceRegistry()
  16. .getService( MultiTenantConnectionProvider.class );
  17. YourMultiTenantConnectionProviderImpl yourMultiTenantConnectionProvider = (YourMultiTenantConnectionProviderImpl) multiTenantConnectionProvider;
  18. yourMultiTenantConnectionProvider.registerTenant( ... );
  19. ...
  20. yourMultiTenantConnectionProvider.deregisterTenant( ... );
Add Comment
Please, Sign In to add comment