|
Hi Michael Simons
a problem I see in your mapping is the same name used for the @JoinColum
@JoinColumn(name="commentable_id", referencedColumnName="id")
in 2 classes
and
belonging to SINGLE_TABLE inheritance and referring to 2 different Entities.
@JoinColumn(name="commentable_id", referencedColumnName="id")
@ManyToOne(fetch=FetchType.EAGER, optional=false)
private Bulletin commentable;
involves the creation of foreign key (commentable_id) references news
@JoinColumn(name="commentable_id", referencedColumnName="id")
@ManyToOne(fetch=FetchType.EAGER, optional=false)
private Page commentable;
while creates foreign key (commentable_id) references page
he same column is used for 2 differents FK and this is not possible. So your problem can be solved assigning 2 different names for the @JoinColumn.
The issue instead remains when no name is assigned to the 2 @JoinComun.
|