Question

I have a long string in an annotation block, like this one (see query property):

/**
 * @Table(name="messages")
 * @Entity
 * @NamedNativeQueries({
 *    @NamedNativeQuery(
 *      name = "searchMessages",
 *      resultClass= "__CLASS__",
 *      query = "SELECT * FROM message WHERE id IN (SELECT post_id FROM (SELECT m.post_id, COUNT(*) AS words FROM phpbb_search_wordmatch m INNER JOIN phpbb_search_wordlist w ON w.id = m.word_id WHERE blah blah blah blah ...."
 *    )
 * })
 */
class Message {
...

which I would like to split across multiple lines to be more readable.

Is it possible to break the query string in multiple lines?

Was it helpful?

Solution

I just found it by myself:

/**
 * @Table(name="messages")
 * @Entity
 * @NamedNativeQueries({
 *    @NamedNativeQuery(
 *      name = "searchMessages",
 *      resultClass= "__CLASS__",
 *      query = "SELECT * FROM message WHERE id IN (
          SELECT post_id FROM (
             SELECT m.post_id, COUNT(*) AS words 
             FROM phpbb_search_wordmatch m 
             INNER JOIN phpbb_search_wordlist w ON w.id = m.word_id 
             WHERE blah blah blah blah ...."
 *    )
 * })
 */
class Message {
...

This works as expected.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top