0
I have four entities (selection, match, bet and bettor) where within the Bet class I have the Ids of a bet and a bettor. When I try to insert a bet by clicking on the match and the player, it generates the following error:
org.hibernate.id.Identifiergenerationexception: ids for this class must be Manually Assigned before Calling save():
Class Bet
public class Aposta implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@Column(name = "idAposta")
private Integer idAposta;
@Size(max = 3)
@Column(name = "Palpite")
private String palpite;
@Size(max = 1)
@Column(name = "Status")
private String status;
@JoinColumn(name = "Apostador_idApostador", referencedColumnName = "idApostador")
@ManyToOne(optional = false, cascade = CascadeType.ALL)
private Apostador apostadoridApostador;
@JoinColumn(name = "Partida_idPartida", referencedColumnName = "idPartida")
@ManyToOne(optional = false, cascade = CascadeType.ALL)
private Partida partidaidPartida;
I believe it’s some kind of mapping now I don’t know which one. I searched that I needed to add the Cascade parameter inside @Manytoone but it still didn’t roll.