When I wish to use SQL queries in Java, I usually hold them in final String variables. Now, when the string is too large, it goes out of page breadth, and we either have to
Here's a creative solution if you don't mind the extra whitespace in generated SQL output:
Paste your formatted SQL statement verbatim into your Java file
Notice the highlighted button, the sixth from the left. That's the awesome "Block Selection Mode" (Alt-Shift-A on Windows). It lets you write opening quotes on each selected line at the same position
Apply the same technique for the closing quotes and the concatenation sign (+
)
No comment needed here.