I'm getting this error but I'm not sure if it is because of the name of mappedBy is the same in to properties
Error
Caused by: org.hibernate.MappingException: Could not determine type for: java.util.Collection, at table: a_escalaPregunta, for columns: [org.hibernate.mapping.Column(valoracioItems)]
Class EscalaPregunta
@Entity
@Table(name = "a_escalaPregunta")
public class EscalaPregunta extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(length = 255)
private String pregunta;
@OneToMany(mappedBy = "pregunta", cascade = CascadeType.ALL)
private Collection<EscalaResposta> respostes;
@OneToMany(mappedBy = "pregunta", cascade = CascadeType.PERSIST)
private Collection<ValoracioItem> valoracioItems;
@Id
public Long getId(){
return id;
}
Class EscalaResposta
@Entity
@Table(name = "a_escalaResposta")
public class EscalaResposta extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne(optional = false)
@JoinColumn(name = "idEscalaPregunta", referencedColumnName = "id", nullable = false)
private EscalaPregunta pregunta;
Class ValoracioItem
@Entity
@Table(name = "t_valoracioitem")
public class ValoracioItem extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne(cascade = CascadeType.PERSIST, optional = false)
@JoinColumn(name = "idEscalaPregunta", nullable = false)
private EscalaPregunta pregunta;
The problem is that the annotation @Id was repeted in the property and the getter method.