code: public void config(Config config) throws ConfigException, HibernateException
    {
      log.trace("config(Config)");
  
      // Hibernate configuration class is the session factory builder
      Configuration configuration = null;
  
      // Hibernate configuration resource is not null if config parameter is null - for zero-config, or provided by config
      // parameter itself as attribute
      String configResource = config != null ? config.getAttribute("config") : DEFAULT_CONFIG;
      if(configResource != null) {
        log.debug("Configure Hibernate from configuration resource |%s|.", configResource);
        configuration = new Configuration();
        configuration.configure(configResource);
      }
      else {
        // at this point config parameter is not null
        log.debug("Configure Hibernate from j(s)-lib configuration object.");
        configuration = hibernateConfiguration(config);
      }
  
      String timeout = configuration.getProperty("hibernate.transaction.timeout");
      this.transactionTimeout = timeout != null ? Integer.parseInt(timeout) : 0;
  
      String driverClassName = configuration.getProperty("hibernate.connection.driver_class");
      if(driverClassName == null) {
        throw new ConfigException("Missing driver class, e.g. property name='hibernate.connection.driver_class' and value 'com.mysql.jdbc.Driver'");
      }
      log.debug("Load database driver |%s|.", driverClassName);
      Classes.forName(driverClassName);
  
      log.debug("Create Hibernate session factory.");
      sessionFactory = configuration.buildSessionFactory();
    }
docs: Hibernate adapter initialization. Read Hibernate properties from configuration object and create the session
  factory; also configure connections pool. All properties from configuration object are passed as they are to
  Hibernate session factory builder.
  <p>
  Scan and register mappings files in the configured package(s). For Hibernate mappings there are
  <code>mappings</code> child elements into configuration object. There can be a not limited number of
  <code>mappings</code> elements but usually it is a single one. A mapping element has <code>package</code> and
  <code>files-pattern</code> attributes. Files pattern is optional with default <code>*.hbm.xml</code>.
  
  @param config configuration object, possible null.
  @throws ConfigException if configuration object is not well formed.
  @throws HibernateException if a property is not recognized by Hibernate session factory builder.