title: how to execute sql statements inside spring boot controller?
body: <p>I want to execute sql statement inside my spring boot controller class with out defining any method in the jpa repository. The statement i want to use is </p>
  
  <pre><code>SELECT UUID();
  </code></pre>
  
  <p>This statement is database related and is not associated with a particular entity. </p>
  
  <p>It would be nice if any one can provide solution for the execution of the above statement via</p>
  
  <ol>
  <li>spring controller class</li>
  <li>jpa repository (if recommended)</li>
  </ol>
  
  <p><strong>update</strong></p>
  
  <p>controller:</p>
  
  <pre><code>@Autowired
  JdbcTemplate jdbcTemplate;
  
  @RequestMapping(value = "/UUID", method = RequestMethod.GET)
  public ResponseEntity&lt;String&gt; getUUID() {
      String uuid = getUUID();
      return buildGuestResponse(uuid);
  }
  
  public String getUUID(){
      UUID uuid = (UUID)jdbcTemplate.queryForObject("select UUID()", UUID.class);
      return uuid.toString();
  }
  </code></pre>