Fixes the javafile to execute the query correctly