Skip to content

Commit

Permalink
fix Member & Group serialize error
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Delannoy committed Mar 5, 2020
1 parent d766b6f commit 4309f64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/fr/kungfunantes/backend/model/Group.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class Group {
private Long id;
private String name;

@OneToMany(mappedBy = "group", fetch = FetchType.LAZY)
@OneToMany(mappedBy = "group")
private List<Member> members;

public Long getId() {
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/fr/kungfunantes/backend/model/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ public class Member {
private String motivation;
private String image;

@ManyToOne(fetch = FetchType.LAZY, optional = false)
@ManyToOne(fetch = FetchType.EAGER, optional = false)
@JoinColumn(name = "profileId", nullable = false)
@JsonIdentityReference(alwaysAsId = true)
@JsonProperty("profileId")
private Profile profile;

@ManyToOne(fetch = FetchType.LAZY, optional = true)
@ManyToOne(fetch = FetchType.EAGER, optional = true)
@JoinColumn(name = "groupId", nullable = true)
@JsonIdentityReference(alwaysAsId = true)
@JsonProperty("groupId")
Expand All @@ -43,6 +43,8 @@ public class Member {
@JsonProperty("rankId")
private Rank rank;

public Member() {}

public Member(Profile profile, Rank rank) {
this.profile = profile;
this.group = null;
Expand Down

0 comments on commit 4309f64

Please sign in to comment.