I have a problem with my code (obviously) and after many searches on Internet, I don't find an answer to my problem, so I ask my question here.
I have this :
@Entity
public class Resident
{
/** Attributes */
@EmbeddedId
private IdResident idResident;
...
@Embeddable
public class IdResident {
@Column(name="NOM")
private String nom;
@ManyToOne
@JoinColumn(name="CODE")
private Port port;
...
@Entity
public class Port
{
/** Attributes */
@Id
@Column(name="CODE")
private String code;
@Column(name="NOM")
private String nom;
...
And I'm using Maven, I've write this in my persistence.xml :
<class>beans.Port</class>
<class>beans.Resident</class>
But when i run the program, no matter what i've write, I have this :
Exception Description: The mapping [port] from the embedded ID class
[class beans.IdResident] is an invalid mapping for this class. An embeddable class that
is used with an embedded ID specification (attribute [idResident] from the source
[class beans.Resident]) can only contain basic mappings. Either remove the non
basic mapping or change the embedded ID specification on the source to be embedded.
I don't see where is my mistake, I think it's because of the IdResident class wich has an Entity object in it, but I don't know how to fiw it
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…