проблемы с JPA при весенней загрузке с Mysql, intellij как ide.
Я сталкиваюсь со следующей ошибкой, когда пытаюсь сохранить сущность Game, но все прекрасно работает, если сохранить Player entity
"Ошибка доступа к полю [private java .lang.Integer com.raul.daus.Entities.Player.idPlayer] по отражению для постоянного свойства [com.raul.daus.Entities.Player #idPlayer]: 1; "
ниже находится объект Game:
@Entity
@Data
@Table(name = "games")
public class Game {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id_game", nullable = false, insertable = false, updatable = false)
private Integer id_game;
@Column(name = "id_dice", nullable = false)
@OneToMany(targetEntity = Dice.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY,
mappedBy = "id", orphanRemoval = true)
private List<Dice> dices = new ArrayList<Dice>();
@ManyToOne(targetEntity = Player.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "idPlayer")
private Integer idPlayer;
@Column(name = "game_result")
private Integer game_result;
Здесь объект Player
Data
@Entity
@Table(name = "players")
public class Player {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "idPlayer", insertable = false, updatable = false, nullable = false)
private Integer idPlayer;
// player name field with 'ANÒNIM' as default
@Column(name = "player_name", nullable = false)
@ColumnDefault("'ANÒNIM'")
private String player_name;
// Timestamp field with the registered date
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "registerDate", nullable = false, updatable = false)
private Date registerDate;
// One to Many relationship with the player games
@OneToMany(targetEntity = Game.class, mappedBy = "idPlayer", fetch = FetchType.LAZY, cascade = CascadeType.ALL,
orphanRemoval = true)
private List<Game> games = new ArrayList<>();
@Column(name = "rate_success", nullable = true, updatable = true)
private double rateSuccess;
спасибо