/** * Create an instance of {@link MappedSchema } * */ public MappedSchema createMappedSchema() { return new MappedSchema(); }
/** * Create an instance of {@link MappedSchema } * */ public MappedSchema createMappedSchema() { return new MappedSchema(); }
Settings settings = new Settings() .withRenderMapping(new RenderMapping() .withSchemata( new MappedSchema().withInput("MY_SCHEMA") .withOutput("MY_SCHEMA") .withTables( new MappedTable().withInput("CUSTOMER") .withOutput("CUSTOMER1"))));
Settings settings = new Settings() .withRenderMapping(new RenderMapping() .withSchemata( new MappedSchema().withInput("THE_SCHEMA") .withOutput("THE_SCHEMA") .withTables( new MappedTable().withInput("PREDEFINED_TABLE") .withOutput("CHANGED_TABLE") ) )); // Add the settings to the DSLContext DSLContext ctx = DSL.using(connection, dialect, settings); // Run your queries with the above ctx ctx.select(PREDEFINED_TABLE.COLUMM) .from(PREDEFINED_TABLE) .fetch();
/** * Add schemata to this mapping * * @param inputSchema The schema known at codegen time to be mapped * @param outputSchema The schema configured at run time to be mapped */ public void add(String inputSchema, String outputSchema) { logDeprecation(); // Find existing mapped schema MappedSchema schema = null; for (MappedSchema s : mapping().getSchemata()) { if (inputSchema.equals(s.getInput())) { schema = s; break; } } if (schema == null) { schema = new MappedSchema().withInput(inputSchema); mapping().getSchemata().add(schema); } // Add new mapping schema.setOutput(outputSchema); }
public PluginDao(final DataSource dataSource, final SQLDialect dialect) throws SQLException { this.dataSource = dataSource; this.dialect = dialect; switch (dialect) { case H2: final String schema; Connection connection = null; try { connection = dataSource.getConnection(); schema = connection.getSchema(); } finally { if (connection != null) { connection.close(); } } final MappedSchema mappedSchema = new MappedSchema().withInput(DEFAULT_SCHEMA_NAME) // As defined by the jOOQ codegen .withOutput(schema); final RenderMapping renderMapping = new RenderMapping().withSchemata(mappedSchema); this.settings = new Settings().withRenderMapping(renderMapping) .withRenderNameStyle(RenderNameStyle.UPPER); break; default: // For MySQL, schema doesn't matter. // For PostgreSQL, assume schema is part of the JDBC url this.settings = new Settings().withRenderSchema(false); break; } }
/** * Add schemata to this mapping * * @param inputSchema The schema known at codegen time to be mapped * @param outputSchema The schema configured at run time to be mapped */ public void add(String inputSchema, String outputSchema) { logDeprecation(); // Find existing mapped schema MappedSchema schema = null; for (MappedSchema s : mapping().getSchemata()) { if (inputSchema.equals(s.getInput())) { schema = s; break; } } if (schema == null) { schema = new MappedSchema().withInput(inputSchema); mapping().getSchemata().add(schema); } // Add new mapping schema.setOutput(outputSchema); }
schema = new MappedSchema().withInput(inputTable.getSchema().getName()); mapping().getSchemata().add(schema);
schema = new MappedSchema().withInput(inputTable.getSchema().getName()); mapping().getSchemata().add(schema);