title: Optimization relationships beetween entityes
body: <p>I have entity like:</p>
  <pre><code>@Entity
  @Table(name = &quot;test&quot;)
  public class TestEntity {
  
  @ElementCollection
  @Column(name = &quot;record_type_id&quot;, nullable = false)
  @CollectionTable(name = &quot;test_entity_record_type&quot;, joinColumns = @JoinColumn(name = &quot;test_entity_id&quot;))
  private Set&lt;RecordType&gt; recordTypes = new HashSet&lt;&gt;();
  
  @ElementCollection
  @Column(name = &quot;record_type_id&quot;, nullable = false)
  @CollectionTable(name = &quot;test_entity_record_type1&quot;, joinColumns = @JoinColumn(name = &quot;test_entity_id&quot;))
  private Set&lt;RecordType&gt; recordTypes1 = new HashSet&lt;&gt;();
  
  @ElementCollection
  @Column(name = &quot;record_type_id&quot;, nullable = false)
  @CollectionTable(name = &quot;test_entity_record_type2&quot;, joinColumns = @JoinColumn(name = &quot;test_entity_id&quot;))
  private Set&lt;RecordType&gt; recordTypes2 = new HashSet&lt;&gt;();
  }
  </code></pre>
  <p>I have 1000 records of entity in DB. When i try to get 1000 entityes i see in logs:</p>
  <ul>
  <li>1000 select to entity table</li>
  <li>1000 select to test_entity_record_type table by test_entity_id</li>
  <li>1000 select to test_entity_record_type1 table by test_entity_id</li>
  <li>1000 select to test_entity_record_type2 table by test_entity_id</li>
  </ul>
  <p>As result time of answer is very long.</p>
  <p>How can i reduce the response time?</p>