DB Lookup KeyMetadata

We recently upgraded to clover 3 and the DB Lookup element which was working previously has ceased to work. The problem seems to be with the org.jetel.lookup.DBLookupTable.getKeyMetadata() method. This method used to figure out the key metadata in the previous version but looks like this method has been modified to throw an java.lang.UnsupportedOperationException exception. I am not sure why this change was made, but how do we avoid this exception?

Hi arvind.kuppusamy,

can you please provide me more information?

* which product you run? (Server|Designer|Engine)
* call stack of exception
* if possible, also graph with all dependencies (you can reduce it to core of problem)

Thank you.

* which product you run? (Server|Designer|Engine)

“kubosj”

Engine

* call stack of exception

“kubosj”

Element [:GRAPH_1]-Phase 0 can’t be initilized.
at org.jetel.graph.TransformationGraph.init(TransformationGraph.java:469)
at org.jetel.graph.runtime.EngineInitializer.initGraph(EngineInitializer.java:239)
at org.jetel.graph.runtime.EngineInitializer.initGraph(EngineInitializer.java:202)
at org.jetel.main.runGraph.runGraph(runGraph.java:364)
at org.jetel.main.runGraph.main(runGraph.java:328)
Caused by: INPUT_PARSER_0 …FATAL ERROR !
Reason: DBLookupTable does not provide key metadata.
at org.jetel.graph.Phase.init(Phase.java:174)
at org.jetel.graph.TransformationGraph.init(TransformationGraph.java:467)
… 4 more
Caused by: java.lang.UnsupportedOperationException: DBLookupTable does not provide key metadata.
at org.jetel.lookup.DBLookupTable.getKeyMetadata(DBLookupTable.java:469)
at com.facorelogic.core.etl.transform.BaseRules.init(BaseRules.java:475)
at org.jetel.component.DataRecordTransform.init(DataRecordTransform.java:96)

* if possible, also graph with all dependencies (you can reduce it to core of problem)

“kubosj”

In this instance I don’t think a graph would be helpful in diagnosing the issue. As mentioned in the description we used to call org.jetel.lookup.DBLookupTable.getKeyMetadata() to get the parameter metadata and now we get this exception. It works fine for a simple lookup but a DBLookup throws the above error. From the source we can see that this method was changed to throw this exception, we would just like to know what is the alternative way of getting this to work because it used to work before.

Thanks,
Arvind

Hi arvind.kuppusamy,

I got this information: method getKeyMetadata() is disabled since 3.0.0 release because implementation had issues. This method is not used in any of our commercial products so it was not fixed since them.

I can give you simplified original implementation:


DataRecord tmpRecord = new DataRecord(new DataRecordMetadata("_tmp_"));
tmpRecord.init();

SQLCloverStatement statement = new SQLCloverStatement(dbConnection, sqlQuery, tmpRecord);
statement.init();

ParameterMetaData sqlMetadata = ((PreparedStatement) statement.getStatement()).getParameterMetaData();

return SQLUtil.dbMetadata2jetel(sqlMetadata, "_dbLookupTable_" + getName(), dbConnection.getJdbcSpecific());

But it will need some effort from your side to make it running.