Answer the question
In order to leave comments, you need to log in
Why is it separated by pluses in sql query?
Met on a project. Why sql query is separated by pluses? For example:
String queryString = "select t.user_id, "
+ " u.family, "
+ " u.name, "
+ " u.otch "
+ " from USERS t "
+ " INNER JOIN fio_user u "
+ " ON u.user_id = t.user_id "
+ " WHERE sysdate between t.date_b and t.date_e "
+ " order by u.family, u.name, u.otch";
users = sess.createSQLQuery(queryString)
.addScalar("user_id", StringType.INSTANCE)
.addScalar("family", StringType.INSTANCE)
.addScalar("name", StringType.INSTANCE)
.addScalar("otch", StringType.INSTANCE)
.list();
Answer the question
In order to leave comments, you need to log in
I figured everything out myself) For the readability of the request, because if you transfer it without pluses, then it will not perceive it as a request.
Then another question, is there any kind of breakdown for pluses, so that you don’t manually drive them into a normal request yourself?
Groovy and Scala have the ability to do unquoted hyphens on every line. These are the so-called multilines. In Java, JEP is also planned, I do not remember in which version.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question