I'm trying out IntelliJ IDEA and it's warning me of a Hibernate association that I don't quite understand.
One Side:
@Entity
@Table(name = "MY_REQ_ASSIGNEE")
public class MyRequestAssignee extends BaseUser {
//...
@OneToMany(fetch = FetchType.EAGER, cascade = {CascadeType.ALL}, mappedBy = "myRequestAssignee")
private Collection<MyRequest> myRequests = new ArrayList<>();
//...
}
Many Side:
@Entity
@Table(name = "MY_REQUEST")
public class MyRequest implements Persistable {
//...
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="ASSIGNEE_ID")
private MyRequestAssignee myRequestAssignee;
//...
}
(Persistable
is just an interface that has the id
property to make sure Hibernate has access to it.)
I see the MyRequestAssignee
type underlined in red and the message reads 'Many To One' attribute type should not be 'Persistence Entity'.
Are there something wrong with my relationships?
For a sanity check, I looked at this post and this post too.
I found this to be caused by the child entity not being defined in hibernate.cfg.xml. The error message could be improved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With