code: @Override
      public synchronized DatabaseEngine duplicate(Properties mergeProperties, final boolean copyEntities) throws DuplicateEngineException {
          if (mergeProperties == null) {
              mergeProperties = new Properties();
          }
  
          final PdbProperties niwProps = properties.clone();
          niwProps.merge(mergeProperties);
  
  
          if (!(niwProps.isSchemaPolicyNone() || niwProps.isSchemaPolicyCreate())) {
              throw new DuplicateEngineException("Duplicate can only be called if pdb.policy is set to 'create' or 'none'");
          }
  
          try {
              DatabaseEngine niw = DatabaseFactory.getConnection(niwProps);
  
              if (copyEntities) {
                  for (MappedEntity entity : entities.values()) {
                      niw.addEntity(entity.getEntity());
                  }
              }
  
              return niw;
          } catch (final Exception e) {
              throw new DuplicateEngineException("Could not duplicate connection", e);
          }
      }
docs: Duplicates a connection.
  
  @param mergeProperties Merge properties with the ones already existing.
  @param copyEntities    True to include the entities in the new connection, false otherwise.
  @return The new connection.
  @throws DuplicateEngineException If policy is set to other than 'create' or 'none' or duplication fails for some reason.