java code for query file generation