You are most likely missing an association mapping (like @OneToMany
) and/or @Entity
annotation(s).
I had a same problem in:
@Entity
public class SomeFee {
@Id
private Long id;
private List<AdditionalFee> additionalFees;
//other fields, getters, setters..
}
class AdditionalFee {
@Id
private int id;
//other fields, getters, setters..
}
and additionalFees
was the field causing the problem.
What I was missing and what helped me are the following:
@Entity
annotation on the generic type argument (AdditionalFee
) class;
@OneToMany
(or any other type of association that fits particular business case) annotation on the private List<AdditionalFee> additionalFees;
field.
So, the working version looked like this:
@Entity
public class SomeFee {
@Id
private Long id;
@OneToMany
private List<AdditionalFee> additionalFees;
//other fields, getters, setters..
}
@Entity
class AdditionalFee {
@Id
private int id;
//other fields, getters, setters..
}