org.jooq.impl.DefaultConfiguration Java Examples
The following examples show how to use
org.jooq.impl.DefaultConfiguration.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Issue318Test.java From SimpleFlatMapper with MIT License | 7 votes |
@Test public void testHsqlDb() throws SQLException { Connection conn = DbHelper.objectDb(); DSLContext dsl = DSL .using(new DefaultConfiguration().set(conn) .set(SQLDialect.HSQLDB) .set(SfmRecordMapperProviderFactory.newInstance().ignorePropertyNotFound().newProvider())); List<Issue318> list = dsl.select() .from("issue318").fetchInto(Issue318.class); assertEquals(1, list.size()); Issue318 value = list.get(0); assertTrue(Math.abs(value.getT().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli() - System.currentTimeMillis()) < 10000); assertNotNull(value.getId()); }
Example #2
Source File: MetricsDSLContextTest.java From micrometer with Apache License 2.0 | 6 votes |
@Test void userExecuteListenerShouldBePreserved() { ExecuteListener userExecuteListener = mock(ExecuteListener.class); Configuration configuration = new DefaultConfiguration().set(() -> userExecuteListener); MetricsDSLContext jooq = withMetrics(using(configuration), meterRegistry, Tags.empty()); ExecuteListenerProvider[] executeListenerProviders = jooq.configuration().executeListenerProviders(); assertThat(executeListenerProviders).hasSize(2); assertThat(executeListenerProviders[0].provide()).isSameAs(userExecuteListener); assertThat(executeListenerProviders[1].provide()).isInstanceOf(JooqExecuteListener.class); SelectSelectStep<Record> select = jooq.tag("name", "selectAllAuthors").select(asterisk()); executeListenerProviders = select.configuration().executeListenerProviders(); assertThat(executeListenerProviders).hasSize(2); assertThat(executeListenerProviders[0].provide()).isSameAs(userExecuteListener); assertThat(executeListenerProviders[1].provide()).isInstanceOf(JooqExecuteListener.class); }
Example #3
Source File: MetricsDSLContextTest.java From micrometer with Apache License 2.0 | 6 votes |
@NonNull private MetricsDSLContext createDatabase(Connection conn) { Configuration configuration = new DefaultConfiguration() .set(conn) .set(SQLDialect.H2); MetricsDSLContext jooq = withMetrics(DSL.using(configuration), meterRegistry, Tags.empty()); jooq.execute("CREATE TABLE author (" + " id int NOT NULL," + " first_name varchar(255) DEFAULT NULL," + " last_name varchar(255) DEFAULT NULL," + " PRIMARY KEY (id)" + ")"); jooq.execute("INSERT INTO author VALUES(1, 'jon', 'schneider')"); return jooq; }
Example #4
Source File: JooqHealthCheckTest.java From droptools with Apache License 2.0 | 6 votes |
private HealthCheck.Result runHealthCheck(MockDataProvider provider) throws Exception { MockConnection mockConnection = new MockConnection(provider) { @Override public Savepoint setSavepoint() throws SQLException { return new Savepoint() { @Override public int getSavepointId() throws SQLException { return 0; } @Override public String getSavepointName() throws SQLException { return "savepoint"; } }; } }; Configuration configuration = new DefaultConfiguration().set(mockConnection); configuration.settings().setExecuteLogging(false); JooqHealthCheck healthCheck = new JooqHealthCheck(configuration, validationQuery); return healthCheck.check(); }
Example #5
Source File: DatabaseModule.java From curiostack with MIT License | 6 votes |
@Provides @Singleton static DSLContext dbContext( DataSource dataSource, DatabaseConfig config, @ForDatabase ListeningExecutorService dbExecutor) { Configuration configuration = new DefaultConfiguration() .set(dbExecutor) .set(SQLDialect.MYSQL) .set(new Settings().withRenderSchema(false)) .set(new DataSourceConnectionProvider(dataSource)) .set(DatabaseUtil.sfmRecordMapperProvider()); if (config.getLogQueries()) { configuration.set(new QueryLogger()); } DSLContext ctx = DSL.using(configuration); // Eagerly trigger JOOQ classinit for better startup performance. ctx.select().from("curio_server_framework_init").getSQL(); return ctx; }
Example #6
Source File: JooqMapperTest.java From SimpleFlatMapper with MIT License | 6 votes |
@Test public void testIgnoreFields() throws Exception { Connection conn = DbHelper.objectDb(); DSLContext dsl = DSL .using(new DefaultConfiguration().set(conn) .set(SQLDialect.HSQLDB) .set(SfmRecordMapperProviderFactory.newInstance().addAlias("id", "noId").ignorePropertyNotFound().newProvider())); List<DbObject> list = dsl.select() .from("TEST_DB_OBJECT").fetchInto(DbObject.class); assertEquals(2, list.size()); assertEquals(0, list.get(0).getId()); list.get(0).setId(1); DbHelper.assertDbObjectMapping(list.get(0)); }
Example #7
Source File: PostgresInsertReturningTest.java From vertx-jooq with MIT License | 6 votes |
private <R extends UpdatableRecord<R>,P,T> void runInsertReturning(Table<R> table, R record, Function<JsonObject, P> pojoMapper, CountDownLatch latch, Handler<AsyncResult<T>> resultHandler) throws InterruptedException { AsyncCompletableFutureQueryExecutor<R,P,T> queryExecutor = new AsyncCompletableFutureQueryExecutor<>( AsyncDatabaseClientProvider.getInstance().getVertx(), AsyncDatabaseClientProvider.getInstance().getClient(Credentials.POSTGRES), pojoMapper, table, false ); Configuration configuration = new DefaultConfiguration(); configuration.set(SQLDialect.POSTGRES); CompletableFuture<T> insertReturning = queryExecutor.insertReturning(dslContext -> dslContext .insertInto(table) .set(record) .returning(table.getPrimaryKey().getFieldsArray()) , keyMapper(table, configuration)); insertReturning.whenComplete((res,x)-> resultHandler.handle(x==null?Future.succeededFuture(res):Future.failedFuture(x))); Assert.assertTrue(latch.await(1, TimeUnit.SECONDS)); }
Example #8
Source File: AbstractReconSqlDBTest.java From hadoop-ozone with Apache License 2.0 | 5 votes |
@Before public void createReconSchemaForTest() throws IOException { injector = Guice.createInjector(getReconSqlDBModules()); dslContext = DSL.using(new DefaultConfiguration().set( injector.getInstance(DataSource.class))); createSchema(injector); }
Example #9
Source File: InitialConfiguration.java From tutorials with MIT License | 5 votes |
public DefaultConfiguration configuration() { DefaultConfiguration jooqConfiguration = new DefaultConfiguration(); jooqConfiguration.set(connectionProvider()); jooqConfiguration.set(new DefaultExecuteListenerProvider(new ExceptionTranslator())); return jooqConfiguration; }
Example #10
Source File: PersistenceContextIntegrationTest.java From tutorials with MIT License | 5 votes |
@Bean public DefaultConfiguration configuration() { DefaultConfiguration jooqConfiguration = new DefaultConfiguration(); jooqConfiguration.set(connectionProvider()); jooqConfiguration.set(new DefaultExecuteListenerProvider(exceptionTransformer())); String sqlDialectName = environment.getRequiredProperty("jooq.sql.dialect"); SQLDialect dialect = SQLDialect.valueOf(sqlDialectName); jooqConfiguration.set(dialect); return jooqConfiguration; }
Example #11
Source File: JooqFactory.java From droptools with Apache License 2.0 | 5 votes |
public Configuration build(Environment environment, PooledDataSourceFactory factory, String name) throws ClassNotFoundException { final Settings settings = buildSettings(); final ManagedDataSource dataSource = factory.build(environment.metrics(), name); final SQLDialect dialect = determineDialect(factory, dataSource); final ConnectionProvider connectionProvider = new DataSourceConnectionProvider(dataSource); final Configuration config = new DefaultConfiguration() .set(settings) .set(dialect) .set(connectionProvider); environment.lifecycle().manage(dataSource); return config; }
Example #12
Source File: Issue537Test.java From SimpleFlatMapper with MIT License | 5 votes |
@Test public void testHsqlDbAsIssue() throws SQLException { SfmRecordMapperProvider recordMapperProvider = SfmRecordMapperProviderFactory .newInstance() .addColumnProperty( k -> k.getField().getName().equalsIgnoreCase("amount"), new RenameProperty("currencyAndAmount_number")) .addColumnProperty( k -> k.getField().getName().equalsIgnoreCase("currencyCode"), new RenameProperty("currencyAndAmount_currency")) .newProvider(); Connection conn = DbHelper.objectDb(); DSLContext dsl = DSL .using(new DefaultConfiguration().set(conn) .set(SQLDialect.HSQLDB) .set(recordMapperProvider)); List<Issue537> list = dsl .select() .from("issue537_b") .fetchInto(Issue537.class); assertEquals(1, list.size()); Issue537 value = list.get(0); assertEquals(100, value.currencyAndAmount.getNumber().doubleValue(), 0.00001); assertEquals("USD", value.currencyAndAmount.getCurrency().getCurrencyCode()); }
Example #13
Source File: JooqMapperTest.java From SimpleFlatMapper with MIT License | 5 votes |
@Test public void testMapperDbObject() throws Exception { Connection conn = DbHelper.objectDb(); DSLContext dsl = DSL .using(new DefaultConfiguration().set(conn) .set(SQLDialect.HSQLDB) .set(new SfmRecordMapperProvider())); List<DbObject> list = dsl.select() .from("TEST_DB_OBJECT").fetchInto(DbObject.class); assertEquals(2, list.size()); DbHelper.assertDbObjectMapping(list.get(0)); }
Example #14
Source File: JooqUnmapperTest.java From SimpleFlatMapper with MIT License | 5 votes |
@Test public void testUnmapping() throws Exception { Connection conn = DbHelper.objectDb(); Configuration cfg = new DefaultConfiguration() .set(conn) .set(SQLDialect.HSQLDB); cfg.set(JooqMapperFactory.newInstance().newRecordUnmapperProvider(new DSLContextProvider() { @Override public DSLContext provide() { return DSL.using(cfg); } })); DSLContext dsl = DSL.using(cfg); Label label = new Label(1, UUID.randomUUID(), "label", false); LabelsRecord labelsRecord = dsl.newRecord(Labels.LABELS, label); assertEquals(label.getId(), labelsRecord.getId()); assertEquals(label.getName(), labelsRecord.getName()); assertEquals(label.getUuid(), labelsRecord.getUuid()); assertEquals(label.getObsolete(), labelsRecord.getObsolete()); }
Example #15
Source File: DITestingConfiguration.java From waltz with Apache License 2.0 | 5 votes |
@Bean @Autowired public DSLContext dsl(DataSource dataSource) { org.jooq.Configuration configuration = new DefaultConfiguration() .set(dataSource) .set(SQLDialect.POSTGRES); return DSL.using(configuration); }
Example #16
Source File: DIBaseConfiguration.java From waltz with Apache License 2.0 | 5 votes |
@Bean @Autowired public DSLContext dsl(DataSource dataSource) { try { SQLDialect.valueOf(dialect); } catch (IllegalArgumentException iae) { System.err.println("Cannot parse sql dialect: "+dialect); throw iae; } // TODO: remove sql server setting, see #4553 Settings dslSettings = new Settings() .withRenderOutputForSQLServerReturningClause(false); if ("true".equals(System.getProperty(JOOQ_DEBUG_PROPERTY))) { dslSettings .withRenderFormatted(true) .withExecuteLogging(true); } org.jooq.Configuration configuration = new DefaultConfiguration() .set(dataSource) .set(SQLDialect.valueOf(dialect)) .set(dslSettings) .set(new SlowQueryListener(databasePerformanceQuerySlowThreshold)); return DSL.using(configuration); }
Example #17
Source File: JooqPersistenceModule.java From hadoop-ozone with Apache License 2.0 | 5 votes |
@Provides @Singleton Configuration getConfiguration(DefaultDataSourceProvider provider) { DataSource dataSource = provider.get(); return new DefaultConfiguration() .set(dataSource) .set(new SpringConnectionProvider(dataSource)) .set(SQLDialect.valueOf(configurationProvider.get().getSqlDialect())); }
Example #18
Source File: WikiServer.java From redpipe with Apache License 2.0 | 5 votes |
@Override protected SQLClient createDbClient(JsonObject config) { JsonObject myConfig = new JsonObject(); if(config.containsKey("db_host")) myConfig.put("host", config.getString("db_host")); if(config.containsKey("db_port")) myConfig.put("port", config.getInteger("db_port")); if(config.containsKey("db_user")) myConfig.put("username", config.getString("db_user")); if(config.containsKey("db_pass")) myConfig.put("password", config.getString("db_pass")); if(config.containsKey("db_name")) myConfig.put("database", config.getString("db_name")); myConfig.put("max_pool_size", config.getInteger("db_max_pool_size", 30)); Vertx vertx = AppGlobals.get().getVertx(); AsyncSQLClient dbClient = PostgreSQLClient.createNonShared(vertx, myConfig); Configuration configuration = new DefaultConfiguration(); configuration.set(SQLDialect.POSTGRES); PagesDao dao = new PagesDao(configuration, dbClient); AppGlobals.get().setGlobal(PagesDao.class, dao); return dbClient; }
Example #19
Source File: PostgresInsertReturningTest.java From vertx-jooq with MIT License | 5 votes |
private <R extends UpdatableRecord<R>,P,T> void runInsertReturning(Table<R> table, R record, Function<JsonObject, P> pojoMapper, CountDownLatch latch, Handler<AsyncResult<T>> resultHandler) { AsyncRXQueryExecutor<R,P,T> queryExecutor = new AsyncRXQueryExecutor<>( AsyncRXDatabaseClientProvider.getInstance().getClient(Credentials.POSTGRES), pojoMapper, table, false ); Configuration configuration = new DefaultConfiguration(); configuration.set(SQLDialect.POSTGRES); Single<T> insertReturning = queryExecutor.insertReturning(dslContext -> dslContext .insertInto(table) .set(record) .returning(table.getPrimaryKey().getFieldsArray()) , keyMapper(table, configuration)); insertReturning.subscribe(new SingleObserver<T>() { @Override public void onSubscribe(Disposable d) { } @Override public void onSuccess(T t) { resultHandler.handle(Future.succeededFuture(t)); } @Override public void onError(Throwable x) { resultHandler.handle(Future.failedFuture(x)); } }); try { Assert.assertTrue(latch.await(1, TimeUnit.SECONDS)); } catch (InterruptedException e) { Assert.fail(e.getMessage()); } }
Example #20
Source File: JooqConfig.java From StubbornJava with MIT License | 5 votes |
public static Configuration defaultConfigFromDataSource(DataSource ds) { DataSourceConnectionProvider dcp = new DataSourceConnectionProvider(ds); Configuration jooqConfig = new DefaultConfiguration(); jooqConfig.set(SQLDialect.MYSQL); jooqConfig.set(dcp); //jooqConfig.set(new ThreadLocalTransactionProvider(dcp)); jooqConfig.settings() .withExecuteWithOptimisticLockingExcludeUnversioned(true); return jooqConfig; }
Example #21
Source File: HsqldbConfigurationProvider.java From vertx-jooq with MIT License | 5 votes |
@Override public org.jooq.Configuration createDAOConfiguration(){ org.jooq.Configuration configuration = new DefaultConfiguration(); configuration.set(SQLDialect.HSQLDB); try { configuration.set(DriverManager.getConnection("jdbc:hsqldb:mem:test", "test", "")); } catch (SQLException e) { throw new AssertionError("Failed setting up DB.",e); } return configuration; }
Example #22
Source File: JooqConfig.java From StubbornJava with MIT License | 5 votes |
public static Configuration defaultConfigFromDataSource(DataSource ds) { DataSourceConnectionProvider dcp = new DataSourceConnectionProvider(ds); Configuration jooqConfig = new DefaultConfiguration(); jooqConfig.set(SQLDialect.MYSQL); jooqConfig.set(dcp); //jooqConfig.set(new ThreadLocalTransactionProvider(dcp)); jooqConfig.settings() .withExecuteWithOptimisticLockingExcludeUnversioned(true); return jooqConfig; }
Example #23
Source File: ScopedContext.java From JOOQ with Apache License 2.0 | 5 votes |
public DSLContext getDSLContext() { if (dslContext == null) { Configuration defaultConfiguration = new DefaultConfiguration().set(getConnection()) .set(SQLDialect.MYSQL); dslContext = DSL.using(defaultConfiguration); } return dslContext; }
Example #24
Source File: UserDataSources.java From secrets-proxy with Apache License 2.0 | 5 votes |
private DSLContext getDslContext(PlatformTransactionManager txManager, DataSource dataSource) { DefaultConfiguration config = new DefaultConfiguration(); config.set(new DataSourceConnectionProvider(new TransactionAwareDataSourceProxy(dataSource))); config.set(new DefaultExecuteListenerProvider(new JooqExceptionTranslator())); config.set(new SpringTransactionProvider(txManager)); return new DefaultDSLContext(config); }
Example #25
Source File: JooqMapperTest.java From SimpleFlatMapper with MIT License | 4 votes |
@Test public void testMapperDbExtendedType() throws Exception { Connection conn = DbHelper.objectDb(); DSLContext dsl = DSL .using(new DefaultConfiguration().set(conn) .set(SQLDialect.HSQLDB) .set(SfmRecordMapperProviderFactory.newInstance().newProvider())); List<DbExtendedType> list = dsl.select() .from("db_extended_type").fetchInto(DbExtendedType.class); assertEquals(1, list.size()); DbExtendedType o = list.get(0); DbExtendedType.assertDbExtended(o); }
Example #26
Source File: JooqConfigurationFactory.java From micronaut-sql with Apache License 2.0 | 4 votes |
/** * Creates jOOQ {@link Configuration}. * It will configure it with available jOOQ provider beans with the same qualifier. * * @param name The data source name * @param dataSource The {@link DataSource} * @param transactionProvider The transaction provider * @param settings The settings * @param executorProvider The executor provider * @param recordMapperProvider The record mapper provider * @param recordUnmapperProvider The record unmapper provider * @param metaProvider The metadata provider * @param ctx The {@link ApplicationContext} * @return A {@link Configuration} */ @EachBean(DataSource.class) public Configuration jooqConfiguration( @Parameter String name, DataSource dataSource, @Parameter @Nullable TransactionProvider transactionProvider, @Parameter @Nullable Settings settings, @Parameter @Nullable ExecutorProvider executorProvider, @Parameter @Nullable RecordMapperProvider recordMapperProvider, @Parameter @Nullable RecordUnmapperProvider recordUnmapperProvider, @Parameter @Nullable MetaProvider metaProvider, ApplicationContext ctx ) { DefaultConfiguration configuration = new DefaultConfiguration(); JooqConfigurationProperties properties = ctx.findBean(JooqConfigurationProperties.class, Qualifiers.byName(name)) .orElseGet(JooqConfigurationProperties::new); DataSourceResolver dataSourceResolver = ctx.findBean(DataSourceResolver.class).orElse(DataSourceResolver.DEFAULT); configuration.setSQLDialect(properties.determineSqlDialect(dataSourceResolver.resolve(dataSource))); configuration.setDataSource(dataSource); if (transactionProvider != null) { configuration.setTransactionProvider(transactionProvider); } if (settings != null) { configuration.setSettings(settings); } if (executorProvider != null) { configuration.setExecutorProvider(executorProvider); } if (recordMapperProvider != null) { configuration.setRecordMapperProvider(recordMapperProvider); } if (recordUnmapperProvider != null) { configuration.setRecordUnmapperProvider(recordUnmapperProvider); } if (metaProvider != null) { configuration.setMetaProvider(metaProvider); } configuration.setExecuteListenerProvider(ctx.getBeansOfType(ExecuteListenerProvider.class, Qualifiers.byName(name)) .toArray(new ExecuteListenerProvider[0])); configuration.setRecordListenerProvider(ctx.getBeansOfType(RecordListenerProvider.class, Qualifiers.byName(name)) .toArray(new RecordListenerProvider[0])); configuration.setVisitListenerProvider(ctx.getBeansOfType(VisitListenerProvider.class, Qualifiers.byName(name)) .toArray(new VisitListenerProvider[0])); configuration.setTransactionListenerProvider(ctx.getBeansOfType(TransactionListenerProvider.class, Qualifiers.byName(name)) .toArray(new TransactionListenerProvider[0])); configuration.setDiagnosticsListenerProvider(ctx.getBeansOfType(DiagnosticsListenerProvider.class, Qualifiers.byName(name)) .toArray(new DiagnosticsListenerProvider[0])); return configuration; }
Example #27
Source File: CategoryConfiguration.java From spring-data-examples with Apache License 2.0 | 4 votes |
public DefaultConfiguration configuration() { DefaultConfiguration jooqConfiguration = new DefaultConfiguration(); jooqConfiguration.set(connectionProvider()); return jooqConfiguration; }
Example #28
Source File: ConfigurationModule.java From guice-persist-jooq with Apache License 2.0 | 4 votes |
protected void configure() { DefaultConfiguration configuration = new DefaultConfiguration(); configuration.setSQLDialect(DIALECT); binder().bind(Configuration.class).toInstance(configuration); }
Example #29
Source File: Issue587Test.java From SimpleFlatMapper with MIT License | 4 votes |
@Test public void testFetchIntoResultSet() throws SQLException { Connection conn = DbHelper.getDbConnection(DbHelper.TargetDB.POSTGRESQL); if (conn == null) return; try { Statement statement = conn.createStatement(); statement.executeUpdate("CREATE TABLE IF NOT EXISTS issue_587(id int, t timestamptz)"); statement.executeUpdate("TRUNCATE issue_587"); statement.executeUpdate("insert into issue_587 values (1, timestamp with time zone '2018-11-15 11:45:11.00000+01:00')"); DSLContext dsl = DSL .using(new DefaultConfiguration().set(conn) .set(SQLDialect.POSTGRES) .set(SfmRecordMapperProviderFactory.newInstance().ignorePropertyNotFound().newProvider())); DynamicJdbcMapper<Issue587> mapper = JdbcMapperFactory.newInstance().newMapper(Issue587.class); OffsetDateTime date = OffsetDateTime.parse("2018-11-15T11:45:11+01:00", DateTimeFormatter.ISO_OFFSET_DATE_TIME); OffsetDateTime expected = date.withOffsetSameInstant(ZoneOffset.UTC); SelectWhereStep<Record> select = dsl.selectFrom("issue_587"); try (ResultSet rs = select.fetch().intoResultSet()) { ResultSetMetaData metaData = rs.getMetaData(); System.out.println("metaData = " + metaData.getColumnType(2)); System.out.println("metaData = " + metaData.getColumnClassName(2)); System.out.println("metaData = " + metaData.getColumnTypeName(2)); while (rs.next()) { System.out.println("rs.getObject(2) = " + rs.getObject(2)); } } try (ResultSet rs = select.fetch().intoResultSet()) { Issue587[] issue587s = mapper.stream(rs).toArray(Issue587[]::new); System.out.println("issue587s = " + Arrays.toString(issue587s)); assertEquals(1, issue587s.length); assertEquals(1, issue587s[0].id); assertEquals(expected, issue587s[0].t); } } finally { conn.close(); } }
Example #30
Source File: Issue587Test.java From SimpleFlatMapper with MIT License | 4 votes |
@Test public void testFetchResultSet() throws SQLException { Connection conn = DbHelper.getDbConnection(DbHelper.TargetDB.POSTGRESQL); if (conn == null) return; try { Statement statement = conn.createStatement(); statement.executeUpdate("CREATE TABLE IF NOT EXISTS issue_587(id int, t timestamptz)"); statement.executeUpdate("TRUNCATE issue_587"); statement.executeUpdate("insert into issue_587 values (1, timestamp with time zone '2018-11-15 11:45:11.00000+01:00')"); DSLContext dsl = DSL .using(new DefaultConfiguration().set(conn) .set(SQLDialect.POSTGRES) .set(SfmRecordMapperProviderFactory.newInstance().ignorePropertyNotFound().newProvider())); DynamicJdbcMapper<Issue587> mapper = JdbcMapperFactory.newInstance().newMapper(Issue587.class); OffsetDateTime date = OffsetDateTime.parse("2018-11-15T11:45:11+01:00", DateTimeFormatter.ISO_OFFSET_DATE_TIME); OffsetDateTime expected = date.withOffsetSameInstant(ZoneOffset.UTC); SelectWhereStep<Record> select = dsl.selectFrom("issue_587"); try (ResultSet rs = select.fetchResultSet()) { ResultSetMetaData metaData = rs.getMetaData(); System.out.println("metaData = " + metaData.getColumnType(2)); System.out.println("metaData = " + metaData.getColumnClassName(2)); System.out.println("metaData = " + metaData.getColumnTypeName(2)); while (rs.next()) { System.out.println("rs.getObject(2) = " + rs.getObject(2)); } } try (ResultSet rs = select.fetchResultSet()) { Issue587[] issue587s = mapper.stream(rs).toArray(Issue587[]::new); System.out.println("issue587s = " + Arrays.toString(issue587s)); assertEquals(1, issue587s.length); assertEquals(1, issue587s[0].id); assertEquals(expected, issue587s[0].t); } } finally { conn.close(); } }