Исправлено сохранение данных

This commit is contained in:
sshkurov
2022-01-31 02:09:27 +03:00
parent 560e0d444f
commit 3d06b25d7a
8 changed files with 20 additions and 20 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;