Commit 4c48be97 authored by Milan Mozolák's avatar Milan Mozolák
Browse files

Added propper adding and removing of missions in country

parent 7b129ee2
Pipeline #122941 waiting for manual action with stage
package; package;
import com.sun.istack.NotNull; import com.sun.istack.NotNull;
import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import javax.persistence.*; import javax.persistence.*;
import java.util.List; import java.util.HashSet;
import java.util.Objects; import java.util.Objects;
import java.util.Set;
/** /**
* @author Milan Mozolak * @author Milan Mozolak
...@@ -54,8 +56,19 @@ public class Country { ...@@ -54,8 +56,19 @@ public class Country {
@Column(nullable = false) @Column(nullable = false)
private String military; private String military;
@OneToMany(mappedBy = "country") @OneToMany(mappedBy = "country")
private List<Mission> missions; private Set<Mission> missions = new HashSet<>();
public void addMission(Mission mission) {
public void removeMission(Mission mission) {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment