title: Is there a way with spring data jdbc avoid n+1 issue?
body: <p>When I run this query, I experience n+1 issue where data JDBC fetches all the related entities of the campaign objects. Is there any way to avoid this using data JDBC?</p>
  <pre><code>@Query(
      &quot;&quot;&quot;
    SELECT campaign.*
    FROM campaign
             JOIN targeting ON campaign.targeting_id = targeting.id
    WHERE (
      CASE
          WHEN campaign.applications_close_date IS NOT NULL
              THEN NOW() BETWEEN campaign.start_date AND campaign.applications_close_date
          WHEN campaign.end_date IS NOT NULL
              THEN NOW() BETWEEN campaign.start_date AND campaign.end_date
          ELSE NOW() &gt;= campaign.start_date
          END
      )
    AND NOT EXISTS
      (
      SELECT *
       FROM application
       WHERE application.campaign = campaign.id
        AND application.influencer = :influencerId 
      )
    &quot;&quot;&quot;
    )
    fun findAllMatchingByInfluencerId(
      influencerId: Long,
      country: String?
    ): List&lt;Campaign&gt;
  </code></pre>