I am ussing micronaut-data framework to a app that store server emails.
I have a entity EMAILDB, that store the email in sql tables.
in this entity i have many to many relations with email address:
@ManyToMany
List<AddressDB> destinatarysTo;
@ManyToMany
List<AddressDB> destinatarysCC;
@ManyToMany
List<AddressDB> destinatarysCCO;
And i have a method that give me this emails in the email repository:
@Join(value = "destinatarysTo", type = Join.Type.LEFT_FETCH)
@Join(value = "destinatarysCC", type = Join.Type.LEFT_FETCH)
@Join(value = "destinatarysCCO", type = Join.Type.LEFT_FETCH)
public List<EmailDB> findByFolder(FolderDB folder);
But when i use it:
java.lang.IllegalArgumentException: org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags
What is the correct way?
thanks