title: Spring Boot Jpa JPQL Selecting columns except specific columns
body: <p>For example, I have two entities with a <code>OneToOne</code> association.</p>
  
  <pre><code>@Entity
  class Entity1(
      @Column val columnToSelect1: String,
      @Column val columnToSelect2: String,
      @Column val columnToSelect3: String,
      @Column val columnToSelect4: String,
      @Column val columnToSelect5: String,
      @Column val columnToSelect6: String,
      @Column val columnToSelect7: String,
      @Column val columnToSelect8: String,
      @Column val columnToSelect9: String,
      @Column val columnToSelect10: String,
  
  
      @OneToOne
      @JoinColumn
      val columnNotToSelect: Entity2
  )
  </code></pre>
  
  <p>And, there are many times when I want to select except specific columns like <code>val columnNotToSelect: Entity2</code>.<br>
  That's because selecting <code>Entity2</code> will cause trigger another query that is NOT always required.</p>
  
  <p>For now, I'm implementing that requirement like this.</p>
  
  <pre><code>interface Entity1Getter {
      fun getColumnToSelect1(): String
      fun getColumnToSelect2(): String
      fun getColumnToSelect3(): String
      ...
  }
  
  interface Entity1CrudRepository : CrudRepository&lt;Entity1, UUID&gt; {
      // select all columns
      fun findAll(): List&lt;Entity1&gt;
  
      // select all columns except columnNotToSelect
      @Query(
          "SELECT " +
          "e.columnToSelect1 as columnToSelect1" +
          "e.columnToSelect2 as columnToSelect2" +
          "e.columnToSelect3 as columnToSelect3" +
          "e.columnToSelect4 as columnToSelect4" +
          "e.columnToSelect5 as columnToSelect5" +
          "e.columnToSelect6 as columnToSelect6" +
          "e.columnToSelect7 as columnToSelect7" +
          "e.columnToSelect8 as columnToSelect8" +
          "e.columnToSelect9 as columnToSelect9" +
          "e.columnToSelect10 as columnToSelect10" +
          "FROM Entity1 e"
      )
      fun findAllExceptOneColumn(): List&lt;Entity1Getter&gt;
  }
  </code></pre>
  
  <p>It's quite inefficient that I have to arrange all columns I want to query.</p>
  
  <h3>Question</h3>
  
  <ol>
  <li>Are there any different ways to <strong>select except specific columns</strong>?</li>
  <li>Or, are there any different ways to <strong>not to select associated columns</strong>? (not to trigger another query)</li>
  </ol>
  
  <p>Thx :D</p>