How to make(bypass) foreign key on different tables?

So we have Oopsey structure with abstract object and its heirs. In another object has a reference to the parent class (where recorded one of the heirs), but when I try this thing to move in the database came to a screeching halt, as it turns out FK felts felts one on another table. How it is solved?
I.e. the question is on the structure of the database table.

PS Heard about polymorphic relationships and that they are evil. But the problem is clearly not the first year exists. As the same address it?
June 14th 19 at 20:12
1 answer
June 14th 19 at 20:14
You can remove constrain, but it is fraught with violation of consistency.
In the projections of the objects (tables) to do conditional redundancy in the form of several fields of references and field type.
Naturally and then it is not ideal. But somehow have to find a compromise between the multidimensionality (PLO) and its projection (relational database). Hence, various option non-relational database

Find more questions by tags JavaSQL