Java Code Examples for org.jooq.Configuration#set()
The following examples show how to use
org.jooq.Configuration#set() .
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: 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 2
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 3
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 4
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 5
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()); }