P
P
pashkent832019-09-11 18:16:23
Java
pashkent83, 2019-09-11 18:16:23

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

2 answer(s)
P
pashkent83, 2019-09-11
@pashkent83

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?

M
mayton2019, 2019-09-11
@mayton2019

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 question

Ask a Question

731 491 924 answers to any question