Двумерный массив объектов spring, jpa, postgres

Нужно занести в базу данных двумерный массив объектов, фрагмент кода:

public class Event {
    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @NotBlank
    @Size(max = 30)
    private String nameevent;

    @NotBlank
    @Size(max = 400)
    private String address;

    @JsonFormat(pattern="yyyy-MM-dd HH:mm")
    @DateTimeFormat
    private Calendar datetime;

    @????
    private  Seat[][] arraySeat;

Класс Seat:

@Entity
@Table(name = "seats")
public class Seat {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;

    private int x;

    private int y;

    @OneToOne(fetch = FetchType.LAZY)
    private Guest guest;

    @Enumerated(EnumType.STRING)
    @Column(length = 20)
    private TypeSeats type;

}

IDE выдает ошибку 'Basic' attribute type should not be 'Seat[][]', ругается на:

private  Seat[][] arraySeat;

в классе Event.

Если использовать аннотацию @ElementCollection, то ошибка :'Element Collection' attribute type should not be array. Как можно решить проблему?


Ответы (0 шт):