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 manually break it (In eclipse, go to a particular place in the string, and place enter, and do it for each of the resulting smaller part), or we can set the formatter in Eclipse to allow only (say) 100 characters per line. But the string is not broken in a logical manner.
I can format a query nicely in SQL Developer (say), but if I paste that in Java, I will have to manually set all the end quotes, and +
symbols to make it a proper Java string. I just want to know a way to have a properly formatted SQL query copy-pasted directly into a Java file. I am using Eclipse.
Perhaps when a query is formatted like :
SELECT
*
FROM
something
WHERE
id=4;
then when its pasted inside a java string, we can have it like :
"SELECT" +
" *" +
" FROM" +
" something" +
" WHERE";
id=4;