This raises the question of SQL-Java coding style ...
How do others relate to creating complex custom queries in Java?
I am talking about a seemingly simple task of preparing a string, which is an SQL operation being performed.
I know HQL as well as stored procedures, but to be honest, I really don't like these solutions. Perhaps you can convince me differently. Stored procedures are annoying to deploy / maintain, and parsing performance is not such a big issue in my case - flexibility takes precedence. HQL seems like a big leap and has some limitations for my complex queries.
To be clear, I'm talking about a super-ugly looking code like this:
return
"(" + topTwenty + ")" +
"UNION " +
"(" + twentyBeforeMe + ")" +
"UNION " +
"(" + meDummyQuery + ")" +
"UNION " +
"(" + twentyAfterMe + ")";
topTwenty , , , .
, , PHP, .
? ? ( -).