You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I call setStartPointNow() a lot of connections are opened.
One for getting all the tables and then the code loops over all tables and opens another connection for each table to get the table name.
Is it possible to refactor this to reuse the already open connection?
public Changes setStartPointNow() {
if (request == null && tablesList == null) {
try (Connection connection = getConnection()) {
tablesList = new LinkedList<>();
DatabaseMetaData metaData = connection.getMetaData();
ResultSet resultSet = metaData.getTables(getCatalog(connection), getSchema(connection), null,
new String[] { "TABLE" });
while (resultSet.next()) {
String tableName = resultSet.getString("TABLE_NAME");
Table t = new Table().setLetterCases(getTableLetterCase(), getColumnLetterCase(), getPrimaryKeyLetterCase())
.setName(getTableLetterCase().convert(tableName));
copyElement(this, t);
tablesList.add(t);
}
} catch (SQLException e) {
throw new AssertJDBException(e);
}
}
...
The copyElement() method within the while loop is the place where another connection is opened to get the table name from database.
I tried to overwrite this, but many of the methods in changes are private so it seems impossible to create a workaround.
The text was updated successfully, but these errors were encountered:
When I call setStartPointNow() a lot of connections are opened.
One for getting all the tables and then the code loops over all tables and opens another connection for each table to get the table name.
Is it possible to refactor this to reuse the already open connection?
The copyElement() method within the while loop is the place where another connection is opened to get the table name from database.
I tried to overwrite this, but many of the methods in changes are private so it seems impossible to create a workaround.
The text was updated successfully, but these errors were encountered: