Исправлено сохранение данных
This commit is contained in:
@@ -28,7 +28,7 @@ public class FoundPattern {
|
||||
@GeneratedValue(generator = "found_pattern_generator")
|
||||
private Long id;
|
||||
|
||||
@ManyToOne
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "packet_id", nullable = false)
|
||||
@Setter
|
||||
private Packet packet;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package ru.serega6531.packmate.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.*;
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
@@ -37,11 +36,11 @@ public class Packet {
|
||||
@Transient
|
||||
private int ttl;
|
||||
|
||||
@Column(name = "stream_id")
|
||||
@JsonIgnore
|
||||
private Long streamId;
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "stream_id", nullable = false)
|
||||
private Stream stream;
|
||||
|
||||
@OneToMany(mappedBy = "packet", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@OneToMany(mappedBy = "packet", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<FoundPattern> matches;
|
||||
|
||||
private long timestamp;
|
||||
|
||||
@@ -6,10 +6,7 @@ import org.hibernate.annotations.GenericGenerator;
|
||||
import ru.serega6531.packmate.model.enums.Protocol;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -36,8 +33,7 @@ public class Stream {
|
||||
|
||||
private Protocol protocol;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JoinColumn(name = "stream_id")
|
||||
@OneToMany(mappedBy = "stream", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@OrderBy("id")
|
||||
@ToString.Exclude
|
||||
private List<Packet> packets;
|
||||
|
||||
Reference in New Issue
Block a user