Source:
protected boolean initConnection() { SQLDirectoryDescriptor descriptor = getDescriptor(); try (Connection sqlConnection = getConnection()) { dialect = Dialect.createDialect(sqlConnection, null); String tableName = descriptor.tableName == null ? descriptor.name : descriptor.tableName; table = SQLHelper.addTable(tableName, dialect, useNativeCase()); SchemaManager schemaManager = Framework.getLocalService(SchemaManager.class); schema = schemaManager.getSchema(getSchema()); if (schema == null) { throw new DirectoryException("schema not found: " + getSchema()); } schemaFieldMap = new LinkedHashMap<>(); readColumnsAll = new LinkedList<>(); readColumns = new LinkedList<>(); boolean hasPrimary = false; for (Field f : schema.getFields()) { String fieldName = f.getName().getLocalName(); schemaFieldMap.put(fieldName, f); if (!isReference(fieldName)) { boolean isId = fieldName.equals(getIdField()); ColumnType type = ColumnType.fromField(f); if (isId && descriptor.isAutoincrementIdField()) { type = ColumnType.AUTOINC; } Column column = SQLHelper.addColumn(table, fieldName, type, useNativeCase()); if (isId) { if (descriptor.isAutoincrementIdField()) { column.setIdentity(true); } column.setPrimary(true); column.setNullable(false); hasPrimary = true; } readColumnsAll.add(column); if (!fieldName.equals(descriptor.passwordField)) { readColumns.add(column); } } } readColumnsAllSQL = readColumnsAll.stream().map(col -> col.getQuotedName()).collect( Collectors.joining(", ")); readColumnsSQL = readColumns.stream().map(col -> col.getQuotedName()).collect(Collectors.joining(", ")); if (!hasPrimary) { throw new DirectoryException(String.format( "Directory '%s' id field '%s' is not present in schema '%s'", getName(), getIdField(), getSchema())); } SQLHelper helper = new SQLHelper(sqlConnection, table, descriptor.getCreateTablePolicy()); boolean loadData = helper.setupTable(); return loadData; } catch (SQLException e) { throw new DirectoryException(e); } }

Target:
protected boolean initConnection() { SQLDirectoryDescriptor descriptor = getDescriptor(); try (Connection sqlConnection = getConnection()) { dialect = Dialect.createDialect(sqlConnection, null); String tableName = descriptor.tableName == null ? descriptor.name : descriptor.tableName; table = SQLHelper.addTable(tableName, dialect, useNativeCase()); SchemaManager schemaManager = Framework.getLocalService(SchemaManager.class); schema = schemaManager.getSchema(getSchema()); if (schema == null) { throw new DirectoryException("schema not found: " + getSchema()); } schemaFieldMap = new LinkedHashMap<>(); readColumnsAll = new LinkedList<>(); readColumns = new LinkedList<>(); boolean hasPrimary = false; for (Field f : schema.getFields()) { String fieldName = f.getName().getLocalName(); schemaFieldMap.put(fieldName, f); if (!isReference(fieldName)) { boolean isId = fieldName.equals(getIdField()); ColumnType type = ColumnType.fromField(f); if (isId && descriptor.isAutoincrementIdField()) { type = ColumnType.AUTOINC; } Column column = SQLHelper.addColumn(table, fieldName, type, useNativeCase()); if (isId) { if (descriptor.isAutoincrementIdField()) { column.setIdentity(true); } column.setPrimary(true); column.setNullable(false); hasPrimary = true; } readColumnsAll.add(column); if (!fieldName.equals(descriptor.passwordField)) { readColumns.add(column); } } } readColumnsAllSQL = readColumnsAll.stream().map(Column::getQuotedName).collect(Collectors.joining(", ")); readColumnsSQL = readColumns.stream().map(Column::getQuotedName).collect(Collectors.joining(", ")); if (!hasPrimary) { throw new DirectoryException(String.format( "Directory '%s' id field '%s' is not present in schema '%s'", getName(), getIdField(), getSchema())); } SQLHelper helper = new SQLHelper(sqlConnection, table, descriptor.getCreateTablePolicy()); boolean loadData = helper.setupTable(); return loadData; } catch (SQLException e) { throw new DirectoryException(e); } }