Who is the accepted author of Psalm 137, and if it was David Hamelech, then is it accepted as a prophecy?
- According to Midrash Eicha Zuta, it was written by ירמיה (Jeremiah). This is also reflected in the Septuagint (aka LXX aka Targum Shivim), which opens with the line "By Jeremias, in the Captivity." This is probably the oldest tradition.
- According to Rashi, Midrash Tehillim (aka Midrash Secher Tov), Pesiqta Rabbatti, Ibn Ezra in his introduction to Tehillim, Daat Mikra, (and, if I'm reading them correctly, Ibn Ezra and Radak on this perek), it was composed by exiled Jews as they "sat by the rivers of Babylon." This approach was accepted by the academics Robert Alter, C.A. Briggs, and M. Buttenwieser.
- According to the Metzudat David, based on the Gemara (Gittin 57b), it was written by King David in a prophetic vision. The Yalkut Shimoni quotes this gemara, and the Malbim and Meiri appear to hold this as well. R' Yeshaya diTrani (aka the רי"ד; commentary available in the Mikraot Gedolot haKeter) writes that this psalm was (my translation) "composed either by David or by one of משוררים (psalmists) about the future; that is to say, this is what Israel will say in their exile."
- According to current academic theory (as stated in the JPS Study Bible and by Prof. Shimon Bar-Efrat of Hebrew University), it was written in Israel by someone who returned from the exile in Babylon.
In the introduction to his Moreh Nevukhei ha-Zman, Nachman Krochmal argues at length for the (Ibn Ezra's) view that this mizmor was composed at the time of the Babylonian exile.