Search in sources :

Example 6 with ResultSetMapper

use of org.skife.jdbi.v2.tweak.ResultSetMapper in project killbill by killbill.

the class DBTestingHelper method getDBI.

@Override
public synchronized IDBI getDBI() {
    if (dbi == null) {
        final RetryableDataSource retryableDataSource = new RetryableDataSource(getDataSource());
        dbi = (DBI) new DBIProvider(null, retryableDataSource, null).get();
        // Register KB specific mappers
        for (final ResultSetMapperFactory resultSetMapperFactory : IDBISetup.mapperFactoriesToRegister()) {
            dbi.registerMapper(resultSetMapperFactory);
        }
        for (final ResultSetMapper resultSetMapper : IDBISetup.mappersToRegister()) {
            dbi.registerMapper(resultSetMapper);
        }
    }
    return dbi;
}
Also used : ResultSetMapperFactory(org.skife.jdbi.v2.ResultSetMapperFactory) ResultSetMapper(org.skife.jdbi.v2.tweak.ResultSetMapper) DBIProvider(org.killbill.commons.jdbi.guice.DBIProvider)

Example 7 with ResultSetMapper

use of org.skife.jdbi.v2.tweak.ResultSetMapper in project SimpleFlatMapper by arnaudroger.

the class SfmResultSetMapperFactory method mapperFor.

@SuppressWarnings("unchecked")
@Override
public ResultSetMapper mapperFor(Class aClass, StatementContext statementContext) {
    ResultSetMapper mapper = cache.get(aClass);
    if (mapper == null) {
        ContextualSourceMapper<ResultSet, ?> resultSetMapper = mapperFactory.newInstance(aClass);
        mapper = toResultSetMapper(resultSetMapper);
        ResultSetMapper<?> cachedMapper = cache.putIfAbsent(aClass, mapper);
        if (cachedMapper != null) {
            mapper = cachedMapper;
        }
    }
    return mapper;
}
Also used : ResultSetMapper(org.skife.jdbi.v2.tweak.ResultSetMapper) ResultSet(java.sql.ResultSet)

Aggregations

ResultSet (java.sql.ResultSet)4 ResultSetMapper (org.skife.jdbi.v2.tweak.ResultSetMapper)4 SQLException (java.sql.SQLException)3 StatementContext (org.skife.jdbi.v2.StatementContext)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Handle (org.skife.jdbi.v2.Handle)2 ResultSetMapperFactory (org.skife.jdbi.v2.ResultSetMapperFactory)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 RosettaMapper (com.hubspot.rosetta.RosettaMapper)1 DruidDataSource (io.druid.client.DruidDataSource)1 Pair (io.druid.java.util.common.Pair)1 CacheScheduler (io.druid.server.lookup.namespace.cache.CacheScheduler)1 DataSegment (io.druid.timeline.DataSegment)1 Endpoint (io.irontest.models.endpoint.Endpoint)1 IOException (java.io.IOException)1 ParameterizedType (java.lang.reflect.ParameterizedType)1 Type (java.lang.reflect.Type)1 PreparedStatement (java.sql.PreparedStatement)1 ResultSetMetaData (java.sql.ResultSetMetaData)1