0

sI have Class 1 where I have

protected Map<String, Object> parameter = new HashMap<String, Object>(); I have Class 2 that extends Class1 and where I do

List list = this.dao.createSQLQuery(query, this.parameter);

createSQLQuery method for dao looks like this:

public List createSQLQuery(final String query, final Map parameter) {

                    for (final String key : parameter.keySet()) {

                     . . .
} }

Why do I have a error in the for cycle line - “incompatible types: Object cannot be converted to String”?

As I understand my case is not the raw type issue because I declare parameter as Map<String, Object> so parameter.keySet() has to return set of Strings

Aido
  • 1
  • 3
  • 1
    Change `Map parameter` to `Map parameter`. – shmosel Dec 18 '22 at 04:42
  • Thanks. It helps with the initial error but generate the next one "name clash: createSQLQuery(String,Map) in DaoImpl and createSQLQuery(String,Map) in Dao have the same erasure, yet neither overrides the other" – Aido Dec 18 '22 at 05:05
  • Do the same for `Dao`. – shmosel Dec 18 '22 at 05:06
  • Besides import statements, you shouldn't have the word `Map` in your code _anywhere_ without a `<` after it, and the same with `List`. – Louis Wasserman Dec 18 '22 at 05:59

0 Answers0