Example usage for org.apache.ibatis.session Configuration setMapUnderscoreToCamelCase

List of usage examples for org.apache.ibatis.session Configuration setMapUnderscoreToCamelCase

Introduction

In this page you can find the example usage for org.apache.ibatis.session Configuration setMapUnderscoreToCamelCase.

Prototype

public void setMapUnderscoreToCamelCase(boolean mapUnderscoreToCamelCase) 

Source Link

Usage

From source file:org.apache.aurora.scheduler.storage.db.DbStorage.java

License:Apache License

/**
 * Creates the SQL schema during service start-up.
 * Note: This design assumes a volatile database engine.
 *//*from ww  w  .j  a v a  2 s. c o m*/
@Override
@Transactional
protected void startUp() throws IOException {
    Configuration configuration = sessionFactory.getConfiguration();
    String createStatementName = "create_tables";
    configuration.setMapUnderscoreToCamelCase(true);

    // The ReuseExecutor will cache jdbc Statements with equivalent SQL, improving performance
    // slightly when redundant queries are made.
    configuration.setDefaultExecutorType(ExecutorType.REUSE);

    addMappedStatement(configuration, createStatementName, CharStreams.toString(
            new InputStreamReader(DbStorage.class.getResourceAsStream("schema.sql"), StandardCharsets.UTF_8)));

    try (SqlSession session = sessionFactory.openSession()) {
        session.update(createStatementName);
    }

    enumBackfill.backfill();

    createPoolMetrics();
}

From source file:org.mybatis.guice.configuration.ConfigurationProvider.java

License:Apache License

@Override
public Configuration get() {
    final Configuration configuration = newConfiguration(environment);
    configuration.setLazyLoadingEnabled(lazyLoadingEnabled);
    configuration.setAggressiveLazyLoading(aggressiveLazyLoading);
    configuration.setMultipleResultSetsEnabled(multipleResultSetsEnabled);
    configuration.setUseGeneratedKeys(useGeneratedKeys);
    configuration.setUseColumnLabel(useColumnLabel);
    configuration.setCacheEnabled(cacheEnabled);
    configuration.setDefaultExecutorType(defaultExecutorType);
    configuration.setAutoMappingBehavior(autoMappingBehavior);
    configuration.setCallSettersOnNulls(callSettersOnNulls);
    configuration.setDefaultStatementTimeout(defaultStatementTimeout);
    configuration.setMapUnderscoreToCamelCase(mapUnderscoreToCamelCase);

    for (ConfigurationSetting setting : configurationSettings) {
        setting.applyConfigurationSetting(configuration);
    }/*from   w  ww  . ja  va 2  s  .  c  o m*/

    try {
        if (databaseIdProvider != null) {
            configuration.setDatabaseId(databaseIdProvider.getDatabaseId(dataSource));
        }

        for (MapperConfigurationSetting setting : mapperConfigurationSettings) {
            setting.applyConfigurationSetting(configuration);
        }

        if (failFast) {
            configuration.getMappedStatementNames();
        }
    } catch (Throwable cause) {
        throw new ProvisionException(
                "An error occurred while building the org.apache.ibatis.session.Configuration", cause);
    } finally {
        ErrorContext.instance().reset();
    }

    return configuration;
}

From source file:org.mybatis.guice.configuration.settings.MapUnderscoreToCamelCaseConfigurationSetting.java

License:Apache License

@Override
public void applyConfigurationSetting(Configuration configuration) {
    configuration.setMapUnderscoreToCamelCase(mapUnderscoreToCamelCase);
}