Merge pull request #50 from rbkmoney/ft/JD-206/fix-lazy-collection-initialization

JD-206 fix lazy collection initialization
This commit is contained in:
ElenaKushchenko 2021-08-02 17:03:58 +03:00 committed by GitHub
commit 67b45129ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -21,7 +21,7 @@ public class MemberEntity implements Serializable {
@ToString.Exclude
@EqualsAndHashCode.Exclude
@ManyToMany(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@ManyToMany(fetch = FetchType.EAGER, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@JoinTable(
name = "member_to_member_role",
joinColumns = @JoinColumn(name = "member_id"),
@ -30,7 +30,7 @@ public class MemberEntity implements Serializable {
@ToString.Exclude
@EqualsAndHashCode.Exclude
@ManyToMany(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@ManyToMany(fetch = FetchType.EAGER, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@JoinTable(
name = "member_to_organization",
joinColumns = @JoinColumn(name = "member_id"),

View File

@ -24,7 +24,7 @@ public class OrganizationEntity implements Serializable {
@ToString.Exclude
@EqualsAndHashCode.Exclude
@ManyToMany(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@ManyToMany(fetch = FetchType.EAGER, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@JoinTable(
name = "member_to_organization",
joinColumns = @JoinColumn(name = "organization_id"),

View File

@ -37,14 +37,17 @@ public abstract class AbstractRepositoryTest {
@Autowired
protected OrganizationRoleRepository organizationRoleRepository;
@BeforeEach
@Transactional
@BeforeEach
public void setUp() throws Exception {
invitationRepository.deleteAll();
organizationRoleRepository.deleteAll();
organizationRepository.deleteAll();
var members = memberRepository.findAll();
members.forEach(it -> it.getRoles().clear());
memberRepository.saveAll(members);
memberRepository.deleteAll();
memberRoleRepository.deleteAll();
organizationRoleRepository.deleteAll();
}
@ClassRule