diff --git a/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupMeta.java b/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupMeta.java index e0f2b25e1ed..3b5e524429d 100644 --- a/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupMeta.java +++ b/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupMeta.java @@ -281,44 +281,32 @@ public void getFields( } try { - DatabaseMeta databaseMeta = - metadataProvider.getSerializer(DatabaseMeta.class).load(variables.resolve(connection)); - - try (Database db = new Database(loggingObject, variables, databaseMeta)) { - // Get the rows from the table... - IRowMeta extraFields = db.getTableFieldsMeta(schemaName, tableName); + // Get the rows from the table... + IRowMeta extraFields = getTableFields(variables); - for (DLField field : fields.fields) { - v = extraFields.searchValueMeta(field.getLookup()); - if (v == null) { - String message = - BaseMessages.getString( - PKG, - "DimensionLookupMeta.Exception.UnableToFindReturnField", - field.getLookup()); - logError(message); - throw new HopTransformException(message); - } + for (DLField field : fields.fields) { + v = extraFields.searchValueMeta(field.getLookup()); + if (v == null) { + String message = + BaseMessages.getString( + PKG, "DimensionLookupMeta.Exception.UnableToFindReturnField", field.getLookup()); + logError(message); + throw new HopTransformException(message); + } - // If the field needs to be renamed, rename - if (StringUtils.isNotEmpty(field.getName())) { - v.setName(field.getName()); - } - v.setOrigin(name); - row.addValueMeta(v); + // If the field needs to be renamed, rename + if (StringUtils.isNotEmpty(field.getName())) { + v.setName(field.getName()); } - } catch (Exception e) { - String message = - BaseMessages.getString( - PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField2"); - logError(message); - throw new HopTransformException(message, e); + v.setOrigin(name); + row.addValueMeta(v); } - } catch (HopException e) { + } catch (Exception e) { String message = - BaseMessages.getString(PKG, "DimensionLookupMeta.Exception.DatabaseErrorOccurred") - + e.getMessage(); + BaseMessages.getString( + PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField2"); logError(message); + throw new HopTransformException(message, e); } }