Github user jakubneubauer commented on a diff in the pull request:
https://github.com/apache/metamodel/pull/164#discussion_r147759008
--- Diff:
jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcUpdateCallback.java ---
@@ -156,20 +158,25 @@ public final TableCreationBuilder createTable(Schema
schema, String name) throws
@Override
public final RowInsertionBuilder insertInto(Table table) throws
IllegalArgumentException, IllegalStateException {
- return new JdbcInsertBuilder(this, table,
getDataContext().getQueryRewriter());
+ return new JdbcInsertBuilder(this, table,
getJdbcDataContext().getQueryRewriter());
+ }
+
+ protected final JdbcDataContext getJdbcDataContext() {
+ return (JdbcDataContext) super.getDataContext();
}
// override the return type to the more specific subtype.
@Override
- public final JdbcDataContext getDataContext() {
- return (JdbcDataContext) super.getDataContext();
+ public final DataContext getDataContext() {
+ final Connection connection = getConnection();
+ return new JdbcUpdateCallbackDataContext(getJdbcDataContext(),
connection);
--- End diff --
Ok, this hack took me a while before I got the idea :-) Clever trick how to
make the associated DataContext use our connection
---