mirror of
https://github.com/valitydev/org-manager.git
synced 2024-11-06 08:25:21 +00:00
Merge pull request #50 from rbkmoney/ft/JD-206/fix-lazy-collection-initialization
JD-206 fix lazy collection initialization
This commit is contained in:
commit
67b45129ec
@ -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"),
|
||||
|
@ -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"),
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user