title: Why List(@OneToMany) with JPA in Entity seen PersistentBag
body: <p>I have two entities as follows Personel.java and PersonelEgitimDurum.java
  List personelEgitimDurumList is PersistentBag in Personel as seen follows;</p>
  
  <pre><code>[enter image description here][1] 
  
  
    [1]: https://i.stack.imgur.com/Q3IC2.png
  </code></pre>
  
  <p>Personel.java as follows;</p>
  
  <pre><code>    @Entity
  @Table(name="personel")
  public class Personel extends BaseEntity {
  
      @OneToOne(cascade = CascadeType.ALL)
      @JoinColumn(name="kisi_id")
      private Kisi kisi;
  
      @Column(name="personel_tipi",length = 2,nullable = false)
      private int personelTipi;
  
      @Column(name="sicil_no",length = 100,nullable = false)
      private String sicilNo;
  
      @OneToMany(fetch = FetchType.EAGER, mappedBy = "personel", cascade =CascadeType.ALL,orphanRemoval = true)
      private List&lt;PersonelEgitimDurum&gt; personelEgitimDurumList= new ArrayList&lt;PersonelEgitimDurum&gt;();
  
      @Column(name="khk_onay",length = 1)
      private int khkOnay;
  }
  </code></pre>
  
  <p>PersonelEgitimDurum.java as follows;</p>
  
  <pre><code>    @Entity
  @Table(name = "personel_egitim_durum", indexes = {@Index(name = "index_personel_egitim_durum", columnList = "id")})
  public class PersonelEgitimDurum extends BaseEntity {
  
      @ManyToOne(cascade=CascadeType.PERSIST,fetch=FetchType.EAGER)
      @JoinColumn(name="personel_id",nullable = false, updatable = true)
      private Personel personel;
  
      @Column(name = "ogrenim_durumu")
      private String ogrenimDurumu;
  
      @Column(name = "okul_id", length = 3)
      private Long okulId;
  
      @Column(name = "universite_bolum_id", length = 4)
      private Long universiteBolumId;
  
      @Column(name = "mezuniyet_tarihi")
      private Date mezuniyetTarihi;
  
      @Column(name = "aciklama", length = 500)
      private String aciklama;
  }
  </code></pre>
  
  <p>PersonelServiceImpl.java as follows;</p>
  
  <pre><code>@Service
  @Transactional
  public class PersonelServiceImpl implements PersonelService {
  @Override
      public PersonelDTO findPersonelByKimlikNo(String kimlikNo) {
          Kisi kisi=kisiDAO.findKisiByKimlikNo(kimlikNo);
          Personel personel=personelDao.findPersonelByKisi(kisi);
          PersonelDTO personelDTO=mapper.toDto(personel);
          return personelDTO;
      }
  }
  </code></pre>
  
  <p>Problem is that personel from findPersonelByKimlikNo in PersonelServiceImpl include that <strong>personelEgitimDurumList is PersistentBag as image</strong>. So mapStruct does not convert entity to dto.</p>
  
  <p>Error log follows;</p>
  
  <pre><code>java.lang.StackOverflowError: null
  at org.hibernate.collection.internal.PersistentBag.size(PersistentBag.java:261) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
  at org.kktcmeb.personel.kktcmebpersonel.mapper.PersonelMapperImpl.personelEgitimDurumListToPersonelEgitimDurumDTOList(PersonelMapperImpl.java:159) ~[classes/:na]
  at org.kktcmeb.personel.kktcmebpersonel.mapper.PersonelMapperImpl.toDto(PersonelMapperImpl.java:53) ~[classes/:na]
  at org.kktcmeb.personel.kktcmebpersonel.mapper.PersonelMapperImpl.personelEgitimDurumToPersonelEgitimDurumDTO(PersonelMapperImpl.java:144) ~[classes/:na]
  at org.kktcmeb.personel.kktcmebpersonel.mapper.PersonelMapperImpl.personelEgitimDurumListToPersonelEgitimDurumDTOList(PersonelMapperImpl.java:161) ~[classes/:na]
  at org.kktcmeb.personel.kktcmebpersonel.mapper.PersonelMapperImpl.toDto(PersonelMapperImpl.java:53) ~[classes/:na]
  </code></pre>
  
  <p>Anyone have idea about this situation? Please help</p>