Hi,
I´m trying to get data from a entity that have a embededId in a entity that have a property like this:
public class MyClass { @OneToMany(mappedBy="formulario", fetch=FetchType.LAZY, cascade = {CascadeType.ALL}) @Cascade({org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN}) private Set<FormularioVinculavel> formularioVinculavel = new HashSet<FormularioVinculavel>(); ... }
And in the class FormularioVinculavel, I have this EmbededId:
@Embeddable public static class ID implements Serializable { @Column(name = "formulario_id") private Long formularioId;
@Column(name = "vinculavel_id") private Long vinculavelId;
public ID(){} public ID(final Long formularioId, final Long vinculavelId) { this.formularioId = formularioId; this.vinculavelId = vinculavelId; } }
@EmbeddedId private ID id = new ID();
But, When I call this.formularioVinculavel inside MyClass, the following error is thrown:
11:50:56,080 ERROR [JDBCExceptionReporter] ORA-00904: "VINCULAVEL1_2_"."ID": invalid identifier
But there is no ID in the table. ID is the name of composite id´class. Why Hibernate is trying to access the column ID if the ID is a composite id?
Thanks in advance,
Sergio Stateri Junior.
|